Skip to content

Commit d6ff986

Browse files
[LLVM][tests/CodeGen/AArch64] Convert instances of ConstantExpr based splats to use splat().
This is mostly NFC but some output does change due to consistently inserting into poison rather than undef and using i64 as the index type for inserts.
1 parent 19cec9c commit d6ff986

17 files changed

+216
-216
lines changed

llvm/test/CodeGen/AArch64/complex-deinterleaving-splat-scalable.ll

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ entry:
4040
%7 = fmul fast <vscale x 2 x double> %2, %0
4141
%8 = fmul fast <vscale x 2 x double> %3, %1
4242
%9 = fsub fast <vscale x 2 x double> %7, %8
43-
%10 = fmul fast <vscale x 2 x double> %9, shufflevector (<vscale x 2 x double> insertelement (<vscale x 2 x double> poison, double 3.000000e+00, i64 0), <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer)
44-
%11 = fmul fast <vscale x 2 x double> %6, shufflevector (<vscale x 2 x double> insertelement (<vscale x 2 x double> poison, double 1.100000e+01, i64 0), <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer)
43+
%10 = fmul fast <vscale x 2 x double> %9, splat (double 3.000000e+00)
44+
%11 = fmul fast <vscale x 2 x double> %6, splat (double 1.100000e+01)
4545
%12 = fadd fast <vscale x 2 x double> %10, %11
46-
%13 = fmul fast <vscale x 2 x double> %9, shufflevector (<vscale x 2 x double> insertelement (<vscale x 2 x double> poison, double 1.100000e+01, i64 0), <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer)
47-
%14 = fmul fast <vscale x 2 x double> %6, shufflevector (<vscale x 2 x double> insertelement (<vscale x 2 x double> poison, double 3.000000e+00, i64 0), <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer)
46+
%13 = fmul fast <vscale x 2 x double> %9, splat (double 1.100000e+01)
47+
%14 = fmul fast <vscale x 2 x double> %6, splat (double 3.000000e+00)
4848
%15 = fsub fast <vscale x 2 x double> %13, %14
4949
%interleaved.vec = tail call <vscale x 4 x double> @llvm.experimental.vector.interleave2.nxv4f64(<vscale x 2 x double> %15, <vscale x 2 x double> %12)
5050
ret <vscale x 4 x double> %interleaved.vec

llvm/test/CodeGen/AArch64/dag-combine-concat-vectors.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ define fastcc i8 @allocno_reload_assign() {
6363
br label %1
6464

6565
1: ; preds = %1, %0
66-
call void @llvm.masked.scatter.nxv16i8.nxv16p0(<vscale x 16 x i8> zeroinitializer, <vscale x 16 x ptr> zeroinitializer, i32 0, <vscale x 16 x i1> xor (<vscale x 16 x i1> shufflevector (<vscale x 16 x i1> icmp eq (<vscale x 16 x ptr> insertelement (<vscale x 16 x ptr> poison, ptr null, i64 0), <vscale x 16 x ptr> zeroinitializer), <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer), <vscale x 16 x i1> shufflevector (<vscale x 16 x i1> insertelement (<vscale x 16 x i1> poison, i1 true, i32 0), <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer)))
66+
call void @llvm.masked.scatter.nxv16i8.nxv16p0(<vscale x 16 x i8> zeroinitializer, <vscale x 16 x ptr> zeroinitializer, i32 0, <vscale x 16 x i1> xor (<vscale x 16 x i1> shufflevector (<vscale x 16 x i1> icmp eq (<vscale x 16 x ptr> insertelement (<vscale x 16 x ptr> poison, ptr null, i64 0), <vscale x 16 x ptr> zeroinitializer), <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer), <vscale x 16 x i1> splat (i1 true)))
6767
br label %1
6868
}
6969

llvm/test/CodeGen/AArch64/fold-int-pow2-with-fmul-or-fdiv.ll

+3-3
Original file line numberDiff line numberDiff line change
@@ -611,9 +611,9 @@ define <vscale x 4 x float> @fdiv_pow2_nx4xfloat(<vscale x 4 x i32> %i) "target-
611611
; CHECK-NEXT: ucvtf z0.s, p0/m, z0.s
612612
; CHECK-NEXT: fdivr z0.s, p0/m, z0.s, z1.s
613613
; CHECK-NEXT: ret
614-
%p2 = shl <vscale x 4 x i32> shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> poison, i32 1, i64 0), <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer), %i
614+
%p2 = shl <vscale x 4 x i32> splat (i32 1), %i
615615
%p2_f = uitofp <vscale x 4 x i32> %p2 to <vscale x 4 x float>
616-
%r = fdiv <vscale x 4 x float> shufflevector (<vscale x 4 x float> insertelement (<vscale x 4 x float> poison, float 9.000000e+00, i64 0), <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer), %p2_f
616+
%r = fdiv <vscale x 4 x float> splat (float 9.000000e+00), %p2_f
617617
ret <vscale x 4 x float> %r
618618
}
619619

@@ -626,6 +626,6 @@ define <vscale x 2 x double> @scalable2(<vscale x 2 x i64> %0) "target-features"
626626
; CHECK-NEXT: fdivr z0.d, p0/m, z0.d, z1.d
627627
; CHECK-NEXT: ret
628628
%2 = uitofp <vscale x 2 x i64> %0 to <vscale x 2 x double>
629-
%3 = fdiv <vscale x 2 x double> shufflevector (<vscale x 2 x double> insertelement (<vscale x 2 x double> poison, double 1.000000e+00, i64 0), <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer), %2
629+
%3 = fdiv <vscale x 2 x double> splat (double 1.000000e+00), %2
630630
ret <vscale x 2 x double> %3
631631
}

llvm/test/CodeGen/AArch64/sve-calling-convention-mixed.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ define void @verify_all_operands_are_initialised() {
724724
; CHECK-NEXT: add sp, sp, #16
725725
; CHECK-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload
726726
; CHECK-NEXT: ret
727-
call void @func_f8_and_v0_passed_via_memory(float 0.0, float 1.0, float 2.0, float 3.0, float 4.0, float 5.0, float 6.0, float 7.0, float 8.0, <vscale x 4 x float> shufflevector (<vscale x 4 x float> insertelement (<vscale x 4 x float> poison, float 9.000000e+00, i64 0), <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer))
727+
call void @func_f8_and_v0_passed_via_memory(float 0.0, float 1.0, float 2.0, float 3.0, float 4.0, float 5.0, float 6.0, float 7.0, float 8.0, <vscale x 4 x float> splat (float 9.000000e+00))
728728
ret void
729729
}
730730

llvm/test/CodeGen/AArch64/sve-expand-div.ll

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ define <vscale x 16 x i8> @sdiv_i8(<vscale x 16 x i8> %a) #0 {
1616
; CHECK-NEXT: lsr z1.b, z0.b, #7
1717
; CHECK-NEXT: add z0.b, z0.b, z1.b
1818
; CHECK-NEXT: ret
19-
%div = sdiv <vscale x 16 x i8> %a, shufflevector (<vscale x 16 x i8> insertelement (<vscale x 16 x i8> undef, i8 3, i32 0), <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer)
19+
%div = sdiv <vscale x 16 x i8> %a, splat (i8 3)
2020
ret <vscale x 16 x i8> %div
2121
}
2222

@@ -30,7 +30,7 @@ define <vscale x 8 x i16> @sdiv_i16(<vscale x 8 x i16> %a) #0 {
3030
; CHECK-NEXT: lsr z1.h, z0.h, #15
3131
; CHECK-NEXT: add z0.h, z0.h, z1.h
3232
; CHECK-NEXT: ret
33-
%div = sdiv <vscale x 8 x i16> %a, shufflevector (<vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 3, i32 0), <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer)
33+
%div = sdiv <vscale x 8 x i16> %a, splat (i16 3)
3434
ret <vscale x 8 x i16> %div
3535
}
3636

@@ -45,7 +45,7 @@ define <vscale x 4 x i32> @sdiv_i32(<vscale x 4 x i32> %a) #0 {
4545
; CHECK-NEXT: lsr z1.s, z0.s, #31
4646
; CHECK-NEXT: add z0.s, z0.s, z1.s
4747
; CHECK-NEXT: ret
48-
%div = sdiv <vscale x 4 x i32> %a, shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 3, i32 0), <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer)
48+
%div = sdiv <vscale x 4 x i32> %a, splat (i32 3)
4949
ret <vscale x 4 x i32> %div
5050
}
5151

@@ -60,7 +60,7 @@ define <vscale x 2 x i64> @sdiv_i64(<vscale x 2 x i64> %a) #0 {
6060
; CHECK-NEXT: lsr z1.d, z0.d, #63
6161
; CHECK-NEXT: add z0.d, z0.d, z1.d
6262
; CHECK-NEXT: ret
63-
%div = sdiv <vscale x 2 x i64> %a, shufflevector (<vscale x 2 x i64> insertelement (<vscale x 2 x i64> undef, i64 3, i32 0), <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer)
63+
%div = sdiv <vscale x 2 x i64> %a, splat (i64 3)
6464
ret <vscale x 2 x i64> %div
6565
}
6666

@@ -76,7 +76,7 @@ define <vscale x 16 x i8> @udiv_i8(<vscale x 16 x i8> %a) #0 {
7676
; CHECK-NEXT: umulh z0.b, p0/m, z0.b, z1.b
7777
; CHECK-NEXT: lsr z0.b, z0.b, #1
7878
; CHECK-NEXT: ret
79-
%div = udiv <vscale x 16 x i8> %a, shufflevector (<vscale x 16 x i8> insertelement (<vscale x 16 x i8> undef, i8 3, i32 0), <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer)
79+
%div = udiv <vscale x 16 x i8> %a, splat (i8 3)
8080
ret <vscale x 16 x i8> %div
8181
}
8282

@@ -89,7 +89,7 @@ define <vscale x 8 x i16> @udiv_i16(<vscale x 8 x i16> %a) #0 {
8989
; CHECK-NEXT: umulh z0.h, p0/m, z0.h, z1.h
9090
; CHECK-NEXT: lsr z0.h, z0.h, #1
9191
; CHECK-NEXT: ret
92-
%div = udiv <vscale x 8 x i16> %a, shufflevector (<vscale x 8 x i16> insertelement (<vscale x 8 x i16> undef, i16 3, i32 0), <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer)
92+
%div = udiv <vscale x 8 x i16> %a, splat (i16 3)
9393
ret <vscale x 8 x i16> %div
9494
}
9595

@@ -103,7 +103,7 @@ define <vscale x 4 x i32> @udiv_i32(<vscale x 4 x i32> %a) #0 {
103103
; CHECK-NEXT: umulh z0.s, p0/m, z0.s, z1.s
104104
; CHECK-NEXT: lsr z0.s, z0.s, #1
105105
; CHECK-NEXT: ret
106-
%div = udiv <vscale x 4 x i32> %a, shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 3, i32 0), <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer)
106+
%div = udiv <vscale x 4 x i32> %a, splat (i32 3)
107107
ret <vscale x 4 x i32> %div
108108
}
109109

@@ -117,7 +117,7 @@ define <vscale x 2 x i64> @udiv_i64(<vscale x 2 x i64> %a) #0 {
117117
; CHECK-NEXT: umulh z0.d, p0/m, z0.d, z1.d
118118
; CHECK-NEXT: lsr z0.d, z0.d, #1
119119
; CHECK-NEXT: ret
120-
%div = udiv <vscale x 2 x i64> %a, shufflevector (<vscale x 2 x i64> insertelement (<vscale x 2 x i64> undef, i64 3, i32 0), <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer)
120+
%div = udiv <vscale x 2 x i64> %a, splat (i64 3)
121121
ret <vscale x 2 x i64> %div
122122
}
123123

llvm/test/CodeGen/AArch64/sve-fp-int-min-max.ll

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ define i64 @scalable_int_min_max(ptr %arg, ptr %arg1, <vscale x 2 x ptr> %i37, <
3333
entry:
3434
%i56 = getelementptr inbounds float, ptr %arg, i64 0
3535
%i57 = load <vscale x 2 x float>, ptr %i56, align 4
36-
%i58 = fmul <vscale x 2 x float> %i57, shufflevector (<vscale x 2 x float> insertelement (<vscale x 2 x float> poison, float 0x401D41D420000000, i64 0), <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer)
37-
%i59 = fadd <vscale x 2 x float> %i58, shufflevector (<vscale x 2 x float> insertelement (<vscale x 2 x float> poison, float 1.023500e+03, i64 0), <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer)
36+
%i58 = fmul <vscale x 2 x float> %i57, splat (float 0x401D41D420000000)
37+
%i59 = fadd <vscale x 2 x float> %i58, splat (float 1.023500e+03)
3838
%i60 = fptosi <vscale x 2 x float> %i59 to <vscale x 2 x i32>
3939
%i61 = tail call <vscale x 2 x i32> @llvm.smax.nxv2i32(<vscale x 2 x i32> %i60, <vscale x 2 x i32> zeroinitializer)
40-
%i62 = tail call <vscale x 2 x i32> @llvm.smin.nxv2i32(<vscale x 2 x i32> %i61, <vscale x 2 x i32> shufflevector (<vscale x 2 x i32> insertelement (<vscale x 2 x i32> poison, i32 1023, i64 0), <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer))
40+
%i62 = tail call <vscale x 2 x i32> @llvm.smin.nxv2i32(<vscale x 2 x i32> %i61, <vscale x 2 x i32> splat (i32 1023))
4141
%i63 = icmp ne <vscale x 2 x i32> %i62, zeroinitializer
4242
%i64 = getelementptr float, ptr %arg1, i64 0
4343
%i65 = tail call <vscale x 2 x float> @llvm.masked.load.nxv2f32.p0(ptr %i64, i32 4, <vscale x 2 x i1> %i63, <vscale x 2 x float> poison)

llvm/test/CodeGen/AArch64/sve-gather-scatter-dag-combine.ll

+6-6
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ define <vscale x 16 x i8> @narrow_i64_gather_index_i8_zext(ptr %out, ptr %in, <v
9595
%wide.load = load <vscale x 16 x i8>, ptr %2, align 1
9696
%3 = zext <vscale x 16 x i8> %wide.load to <vscale x 16 x i64>
9797
%4 = getelementptr inbounds i8, ptr %in, <vscale x 16 x i64> %3
98-
%wide.masked.gather = call <vscale x 16 x i8> @llvm.masked.gather.nxv16i8.nxv16p0(<vscale x 16 x ptr> %4, i32 1, <vscale x 16 x i1> shufflevector (<vscale x 16 x i1> insertelement (<vscale x 16 x i1> poison, i1 true, i32 0), <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer), <vscale x 16 x i8> undef)
98+
%wide.masked.gather = call <vscale x 16 x i8> @llvm.masked.gather.nxv16i8.nxv16p0(<vscale x 16 x ptr> %4, i32 1, <vscale x 16 x i1> splat (i1 true), <vscale x 16 x i8> undef)
9999
ret <vscale x 16 x i8> %wide.masked.gather
100100
}
101101

@@ -121,7 +121,7 @@ define <vscale x 16 x i8> @narrow_i64_gather_index_i8_sext(ptr %out, ptr %in, <v
121121
%wide.load = load <vscale x 16 x i8>, ptr %2, align 1
122122
%3 = sext <vscale x 16 x i8> %wide.load to <vscale x 16 x i64>
123123
%4 = getelementptr inbounds i8, ptr %in, <vscale x 16 x i64> %3
124-
%wide.masked.gather = call <vscale x 16 x i8> @llvm.masked.gather.nxv16i8.nxv16p0(<vscale x 16 x ptr> %4, i32 1, <vscale x 16 x i1> shufflevector (<vscale x 16 x i1> insertelement (<vscale x 16 x i1> poison, i1 true, i32 0), <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer), <vscale x 16 x i8> undef)
124+
%wide.masked.gather = call <vscale x 16 x i8> @llvm.masked.gather.nxv16i8.nxv16p0(<vscale x 16 x ptr> %4, i32 1, <vscale x 16 x i1> splat (i1 true), <vscale x 16 x i8> undef)
125125
ret <vscale x 16 x i8> %wide.masked.gather
126126
}
127127

@@ -141,7 +141,7 @@ define <vscale x 8 x i16> @narrow_i64_gather_index_i16_zext(ptr %out, ptr %in, <
141141
%wide.load = load <vscale x 8 x i16>, ptr %2, align 1
142142
%3 = zext <vscale x 8 x i16> %wide.load to <vscale x 8 x i64>
143143
%4 = getelementptr inbounds i16, ptr %in, <vscale x 8 x i64> %3
144-
%wide.masked.gather = call <vscale x 8 x i16> @llvm.masked.gather.nxv8i16.nxv8p0(<vscale x 8 x ptr> %4, i32 1, <vscale x 8 x i1> shufflevector (<vscale x 8 x i1> insertelement (<vscale x 8 x i1> poison, i1 true, i32 0), <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer), <vscale x 8 x i16> undef)
144+
%wide.masked.gather = call <vscale x 8 x i16> @llvm.masked.gather.nxv8i16.nxv8p0(<vscale x 8 x ptr> %4, i32 1, <vscale x 8 x i1> splat (i1 true), <vscale x 8 x i16> undef)
145145
ret <vscale x 8 x i16> %wide.masked.gather
146146
}
147147

@@ -161,7 +161,7 @@ define <vscale x 8 x i16> @narrow_i64_gather_index_i16_sext(ptr %out, ptr %in, <
161161
%wide.load = load <vscale x 8 x i16>, ptr %2, align 1
162162
%3 = sext <vscale x 8 x i16> %wide.load to <vscale x 8 x i64>
163163
%4 = getelementptr inbounds i16, ptr %in, <vscale x 8 x i64> %3
164-
%wide.masked.gather = call <vscale x 8 x i16> @llvm.masked.gather.nxv8i16.nxv8p0(<vscale x 8 x ptr> %4, i32 1, <vscale x 8 x i1> shufflevector (<vscale x 8 x i1> insertelement (<vscale x 8 x i1> poison, i1 true, i32 0), <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer), <vscale x 8 x i16> undef)
164+
%wide.masked.gather = call <vscale x 8 x i16> @llvm.masked.gather.nxv8i16.nxv8p0(<vscale x 8 x ptr> %4, i32 1, <vscale x 8 x i1> splat (i1 true), <vscale x 8 x i16> undef)
165165
ret <vscale x 8 x i16> %wide.masked.gather
166166
}
167167

@@ -177,7 +177,7 @@ define <vscale x 4 x i32> @no_narrow_i64_gather_index_i32(ptr %out, ptr %in, <vs
177177
%wide.load = load <vscale x 4 x i32>, ptr %2, align 1
178178
%3 = zext <vscale x 4 x i32> %wide.load to <vscale x 4 x i64>
179179
%4 = getelementptr inbounds i32, ptr %in, <vscale x 4 x i64> %3
180-
%wide.masked.gather = call <vscale x 4 x i32> @llvm.masked.gather.nxv4i32.nxv4p0(<vscale x 4 x ptr> %4, i32 1, <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i32 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), <vscale x 4 x i32> undef)
180+
%wide.masked.gather = call <vscale x 4 x i32> @llvm.masked.gather.nxv4i32.nxv4p0(<vscale x 4 x ptr> %4, i32 1, <vscale x 4 x i1> splat (i1 true), <vscale x 4 x i32> undef)
181181
ret <vscale x 4 x i32> %wide.masked.gather
182182
}
183183

@@ -192,7 +192,7 @@ define <vscale x 2 x i64> @no_narrow_i64_gather_index_i64(ptr %out, ptr %in, <vs
192192
%2 = bitcast ptr %1 to ptr
193193
%wide.load = load <vscale x 2 x i64>, ptr %2, align 1
194194
%3 = getelementptr inbounds i64, ptr %in, <vscale x 2 x i64> %wide.load
195-
%wide.masked.gather = call <vscale x 2 x i64> @llvm.masked.gather.nxv2i64.nxv2p0(<vscale x 2 x ptr> %3, i32 1, <vscale x 2 x i1> shufflevector (<vscale x 2 x i1> insertelement (<vscale x 2 x i1> poison, i1 true, i32 0), <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer), <vscale x 2 x i64> undef)
195+
%wide.masked.gather = call <vscale x 2 x i64> @llvm.masked.gather.nxv2i64.nxv2p0(<vscale x 2 x ptr> %3, i32 1, <vscale x 2 x i1> splat (i1 true), <vscale x 2 x i64> undef)
196196
ret <vscale x 2 x i64> %wide.masked.gather
197197
}
198198

0 commit comments

Comments
 (0)