@@ -564,3 +564,30 @@ define double @powi_fmul_powi_x_overflow(double noundef %x) {
564
564
%mul = fmul reassoc double %p1 , %x
565
565
ret double %mul
566
566
}
567
+
568
+ define <3 x float > @powi_unary_shuffle_ops (<3 x float > %x , i32 %power ) {
569
+ ; CHECK-LABEL: @powi_unary_shuffle_ops(
570
+ ; CHECK-NEXT: [[TMP1:%.*]] = call <3 x float> @llvm.powi.v3f32.i32(<3 x float> [[X:%.*]], i32 [[POWER:%.*]])
571
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <3 x float> [[TMP1]], <3 x float> poison, <3 x i32> <i32 1, i32 0, i32 2>
572
+ ; CHECK-NEXT: ret <3 x float> [[R]]
573
+ ;
574
+ %sx = shufflevector <3 x float > %x , <3 x float > poison, <3 x i32 > <i32 1 , i32 0 , i32 2 >
575
+ %r = call <3 x float > @llvm.powi (<3 x float > %sx , i32 %power )
576
+ ret <3 x float > %r
577
+ }
578
+
579
+ ; Negative test - multiple uses
580
+
581
+ define <3 x float > @powi_unary_shuffle_ops_use (<3 x float > %x , i32 %power , ptr %p ) {
582
+ ; CHECK-LABEL: @powi_unary_shuffle_ops_use(
583
+ ; CHECK-NEXT: [[SX:%.*]] = shufflevector <3 x float> [[X:%.*]], <3 x float> poison, <3 x i32> <i32 1, i32 0, i32 2>
584
+ ; CHECK-NEXT: store <3 x float> [[SX]], ptr [[P:%.*]], align 16
585
+ ; CHECK-NEXT: [[TMP1:%.*]] = call <3 x float> @llvm.powi.v3f32.i32(<3 x float> [[X]], i32 [[POWER:%.*]])
586
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <3 x float> [[TMP1]], <3 x float> poison, <3 x i32> <i32 1, i32 0, i32 2>
587
+ ; CHECK-NEXT: ret <3 x float> [[R]]
588
+ ;
589
+ %sx = shufflevector <3 x float > %x , <3 x float > poison, <3 x i32 > <i32 1 , i32 0 , i32 2 >
590
+ store <3 x float > %sx , ptr %p
591
+ %r = call <3 x float > @llvm.powi (<3 x float > %sx , i32 %power )
592
+ ret <3 x float > %r
593
+ }
0 commit comments