[clang] Fixed vec_pack_to_short_fp32 in Clang altivec.h (PR #129923)

Lei Huang via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 7 10:52:27 PST 2025


https://github.com/lei137 commented:

Thank-you for the fix John!

It would be good if your patch can show the changes that is being introduced via this patch.  In prep for that I have put up a [PR](https://github.com/llvm/llvm-project/pull/130324) to add the existing checks for this test.  Can you add the changes that will be introduced as part of this PR?  Here is the diff once my patch lands.

```
diff --git a/clang/test/CodeGen/PowerPC/builtins-ppc-p9vector.c b/clang/test/CodeGen/PowerPC/builtins-ppc-p9vector.c
index 68d32ee14c8f..824267b98564 100644
--- a/clang/test/CodeGen/PowerPC/builtins-ppc-p9vector.c
+++ b/clang/test/CodeGen/PowerPC/builtins-ppc-p9vector.c
@@ -854,15 +854,13 @@ vector unsigned short test74(void) {
 // CHECK-BE: @llvm.ppc.vsx.xvcvsphp(<4 x float>
 // CHECK-BE: @llvm.ppc.vsx.xvcvsphp(<4 x float>
 // CHECK-BE: [[REG0:%[0-9]+]] = call <4 x i32> @llvm.ppc.altivec.vperm
-// CHECK-BE-NEXT: [[REG1:%[0-9]+]] = bitcast <4 x i32> [[REG0]] to <4 x float>
-// CHECK-BE-NEXT: [[REG2:%[0-9]+]] = bitcast <4 x float> [[REG1]] to <8 x i16>
-// CHECK-BE-NEXT: ret <8 x i16> [[REG2]]
+// CHECK-BE-NEXT: [[REG1:%[0-9]+]] = bitcast <4 x i32> [[REG0]] to <8 x i16>
+// CHECK-BE-NEXT: ret <8 x i16> [[REG1]]
 // CHECK: @llvm.ppc.vsx.xvcvsphp(<4 x float>
 // CHECK: @llvm.ppc.vsx.xvcvsphp(<4 x float>
 // CHECK: [[REG0:%[0-9]+]] = call <4 x i32> @llvm.ppc.altivec.vperm
-// CHECK-NEXT: [[REG1:%[0-9]+]] = bitcast <4 x i32> [[REG0]] to <4 x float>
-// CHECK-NEXT: [[REG2:%[0-9]+]] = bitcast <4 x float> [[REG1]] to <8 x i16>
-// CHECK-NEXT: ret <8 x i16> [[REG2]]
+// CHECK-NEXT: [[REG1:%[0-9]+]] = bitcast <4 x i32> [[REG0]] to <8 x i16>
+// CHECK-NEXT: ret <8 x i16> [[REG1]]
   return vec_pack_to_short_fp32(vfa, vfb);
 }
 vector unsigned int test75(void) {
```
Thank-you!

https://github.com/llvm/llvm-project/pull/129923


More information about the cfe-commits mailing list