================
@@ -162,6 +164,27 @@ void test_builtin_reduce_minimum(float4 vf1) {
   const double r4 = __builtin_reduce_minimum(vf1_as_one);
 }
 
+void test_builtin_reduce_addf(float4 vf1, half8 vf2) {
+  // CHECK-LABEL: define void @test_builtin_reduce_addf(
+
+  // CHECK:      [[V0:%.+]] = load <4 x float>, ptr %vf1.addr, align 16
+  // CHECK-NEXT: call reassoc float @llvm.vector.reduce.fadd.v4f32(float 
1.000000e+00, <4 x float> [[V0]])
+  float r1 = __builtin_reduce_assoc_fadd(vf1, 1.0f);
+
+  // CHECK:      [[V1:%.+]] = load <4 x float>, ptr %vf1.addr, align 16
+  // CHECK-NEXT: call float @llvm.vector.reduce.fadd.v4f32(float 2.000000e+00, 
<4 x float> [[V1]])
+  float r2 = __builtin_reduce_in_order_fadd(vf1, 2.0f);
+
+  // CHECK:      [[V2:%.+]] = load <8 x half>, ptr %vf2.addr, align 16
+  // CHECK-NEXT: call reassoc half @llvm.vector.reduce.fadd.v8f16(half 
0xH8000, <8 x half> [[V2:%.+]])
+  _Float16 r3 = __builtin_reduce_assoc_fadd(vf2);
+
+  // CHECK:      [[V3:%.+]] = load <8 x half>, ptr %vf2.addr, align 16
+  // CHECK-NEXT: [[RDX:%.+]] = call half @llvm.vector.reduce.fadd.v8f16(half 
0xH8000, <8 x half> [[V3]])
+  // CHECK-NEXT: fpext half [[RDX]] to float
+  float r4 = __builtin_reduce_in_order_fadd(vf2, -0.0f);
+}
----------------
sdesmalen-arm wrote:

Can you also add a test where the start value is not a constant?
And also one for: `_Float16 r5 = __builtin_reduce_assoc_fadd(vf1)` ?

https://github.com/llvm/llvm-project/pull/176160
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to