[PATCH] D24674: [mips] MSA intrinsics header file

Matthew Fortune via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 20 08:04:21 PDT 2016


mpf added inline comments.

================
Comment at: test/CodeGen/builtins-mips-msa.c:8
@@ -13,4 +7,3 @@
+
 typedef __fp16 v8f16 __attribute__ ((vector_size(16)));
 
----------------
vkalintiris wrote:
> @mpf
> 
> Would it be problematic to expose this typedef from msa.h?
Yes it would unfortunately.

We don't have an __fp16 type in the MIPS ABIs so it doesn't really exist. The MSA builtins are in fact not defined in terms of half-float they are just represented as integers via v8i16. This is because there is very little you can do with the half-float type in general apart from the conversions.

I also notice in the test case that v8f16 is used in numerous places where it should be v4f32 and v4f32 where it should be v2f64 (I think). I'll highlight an example below.

================
Comment at: test/CodeGen/builtins-mips-msa.c:361
@@ -367,3 +360,3 @@
 
-  v8f16_r = __builtin_msa_fexdo_h(v4f32_a, v4f32_b); // CHECK: call <8 x half> @llvm.mips.fexdo.h(
-  v4f32_r = __builtin_msa_fexdo_w(v2f64_a, v2f64_b); // CHECK: call <4 x float> @llvm.mips.fexdo.w(
+  v8f16_r = __msa_fexdo_h(v4f32_a, v4f32_b); // CHECK: call <8 x half> @llvm.mips.fexdo.h(
+  v4f32_r = __msa_fexdo_w(v2f64_a, v2f64_b); // CHECK: call <4 x float> @llvm.mips.fexdo.w(
----------------
This is a correct use of v8f16.

================
Comment at: test/CodeGen/builtins-mips-msa.c:390
@@ -396,3 +389,3 @@
 
-  v4f32_r = __builtin_msa_flog2_w(v8f16_a); // CHECK: call <4 x float>  @llvm.mips.flog2.w(
-  v2f64_r = __builtin_msa_flog2_d(v4f32_a); // CHECK: call <2 x double> @llvm.mips.flog2.d(
+  v4f32_r = __msa_flog2_w(v8f16_a); // CHECK: call <4 x float>  @llvm.mips.flog2.w(
+  v2f64_r = __msa_flog2_d(v4f32_a); // CHECK: call <2 x double> @llvm.mips.flog2.d(
----------------
This is an incorrect use of v8f16. There are many more.

================
Comment at: test/CodeGen/builtins-mips-msa.c:391
@@ -399,1 +390,3 @@
+  v4f32_r = __msa_flog2_w(v8f16_a); // CHECK: call <4 x float>  @llvm.mips.flog2.w(
+  v2f64_r = __msa_flog2_d(v4f32_a); // CHECK: call <2 x double> @llvm.mips.flog2.d(
 
----------------
This should be v2f64 I believe, there are many more of these too.


https://reviews.llvm.org/D24674





More information about the cfe-commits mailing list