Skip to content

Commit bf558a3

Browse files
Further relax concrete simd ir tests (#82242)
It turns out that on some targets we generate a call to initialize a SIMD vector from a Builtin.Vec, even though everything is transparent, so the checks for the return using a specific value were too fragile. rdar://153260158
1 parent 020dde5 commit bf558a3

5 files changed

+8
-35
lines changed

test/stdlib/SIMDFloatComparisons.swift.gyb

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ func compare_eq${n}x${bits}(
4242
// CHECK${arch}: compare_eq${n}x${bits}{{.*}} {
4343
// CHECK${arch}: entry:
4444
// CHECK${arch}: [[TMP:%[0-9]+]] = fcmp oeq <${n} x ${llvm}> %0, %1
45-
// CHECK${arch}-NEXT: [[RES:%[0-9]+]] = sext <${n} x i1> [[TMP]] to <${n} x i${bits}>
46-
// CHECK${arch}-NEXT: ret <${n} x i${bits}> [[RES]]
45+
// CHECK${arch}-NEXT: sext <${n} x i1> [[TMP]] to <${n} x i${bits}>
4746

4847
% if bits == 16:
4948
#if arch(arm64)
@@ -60,8 +59,7 @@ func compare_ne${n}x${bits}(
6059
// CHECK${arch}: compare_ne${n}x${bits}{{.*}} {
6160
// CHECK${arch}: entry:
6261
// CHECK${arch}: [[TMP:%[0-9]+]] = fcmp une <${n} x ${llvm}> %0, %1
63-
// CHECK${arch}-NEXT: [[RES:%[0-9]+]] = sext <${n} x i1> [[TMP]] to <${n} x i${bits}>
64-
// CHECK${arch}-NEXT: ret <${n} x i${bits}> [[RES]]
62+
// CHECK${arch}-NEXT: sext <${n} x i1> [[TMP]] to <${n} x i${bits}>
6563

6664
% if bits == 16:
6765
#if arch(arm64)
@@ -78,8 +76,7 @@ func compare_lt${n}x${bits}(
7876
// CHECK${arch}: compare_lt${n}x${bits}{{.*}} {
7977
// CHECK${arch}: entry:
8078
// CHECK${arch}: [[TMP:%[0-9]+]] = fcmp olt <${n} x ${llvm}> %0, %1
81-
// CHECK${arch}-NEXT: [[RES:%[0-9]+]] = sext <${n} x i1> [[TMP]] to <${n} x i${bits}>
82-
// CHECK${arch}-NEXT: ret <${n} x i${bits}> [[RES]]
79+
// CHECK${arch}-NEXT: sext <${n} x i1> [[TMP]] to <${n} x i${bits}>
8380

8481
% if bits == 16:
8582
#if arch(arm64)
@@ -96,8 +93,7 @@ func compare_le${n}x${bits}(
9693
// CHECK${arch}: compare_le${n}x${bits}{{.*}} {
9794
// CHECK${arch}: entry:
9895
// CHECK${arch}: [[TMP:%[0-9]+]] = fcmp ole <${n} x ${llvm}> %0, %1
99-
// CHECK${arch}-NEXT: [[RES:%[0-9]+]] = sext <${n} x i1> [[TMP]] to <${n} x i${bits}>
100-
// CHECK${arch}-NEXT: ret <${n} x i${bits}> [[RES]]
96+
// CHECK${arch}-NEXT: sext <${n} x i1> [[TMP]] to <${n} x i${bits}>
10197

10298
% if bits == 16:
10399
#if arch(arm64)
@@ -114,8 +110,7 @@ func compare_ge${n}x${bits}(
114110
// CHECK${arch}: compare_ge${n}x${bits}{{.*}} {
115111
// CHECK${arch}: entry:
116112
// CHECK${arch}: [[TMP:%[0-9]+]] = fcmp oge <${n} x ${llvm}> %0, %1
117-
// CHECK${arch}-NEXT: [[RES:%[0-9]+]] = sext <${n} x i1> [[TMP]] to <${n} x i${bits}>
118-
// CHECK${arch}-NEXT: ret <${n} x i${bits}> [[RES]]
113+
// CHECK${arch}-NEXT: sext <${n} x i1> [[TMP]] to <${n} x i${bits}>
119114

120115
% if bits == 16:
121116
#if arch(arm64)
@@ -132,8 +127,7 @@ func compare_gt${n}x${bits}(
132127
// CHECK${arch}: compare_gt${n}x${bits}{{.*}} {
133128
// CHECK${arch}: entry:
134129
// CHECK${arch}: [[TMP:%[0-9]+]] = fcmp ogt <${n} x ${llvm}> %0, %1
135-
// CHECK${arch}-NEXT: [[RES:%[0-9]+]] = sext <${n} x i1> [[TMP]] to <${n} x i${bits}>
136-
// CHECK${arch}-NEXT: ret <${n} x i${bits}> [[RES]]
130+
// CHECK${arch}-NEXT: sext <${n} x i1> [[TMP]] to <${n} x i${bits}>
137131

138132
% end
139133
% end

test/stdlib/SIMDFloatInitializers.swift.gyb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,10 @@ func repeating${n}x${bits}(_ scalar: ${scalar}) -> SIMD${n}<${scalar}> {
3737
% if bits == 16:
3838
#endif
3939
% end
40-
4140
// CHECK${arch}: repeating${n}x${bits}{{.*}} {
4241
// CHECK${arch}: entry:
4342
// CHECK${arch}: [[TMP:%[0-9]+]] = insertelement <${n} x ${llvm}> {{.*}} ${llvm} %0, i32 0
4443
// CHECK${arch}-NEXT: [[REP:%[0-9]+]] = shufflevector <${n} x ${llvm}> [[TMP]], <${n} x ${llvm}> {{.*}}, <${n} x i32> zeroinitializer
45-
% if totalBits == 64:
46-
// CHECK-arm64-NEXT: ret <${n} x ${llvm}> [[REP]]
47-
% else:
48-
// CHECK${arch}-NEXT: ret <${n} x ${llvm}> [[REP]]
49-
% end
5044

5145
% end
5246
% end

test/stdlib/SIMDMaskInitializers.swift.gyb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ func repeating${n}_mask${bits}(_ scalar: Bool) -> SIMDMask<SIMD${n}<Int${bits}>>
2727
// CHECK: entry:
2828
// CHECK: [[TMP:%[0-9]+]] = insertelement <${n} x i${bits}> {{.*}}, i${bits} %{{.*}}, i32 0
2929
// CHECK-NEXT: [[REP:%[0-9]+]] = shufflevector <${n} x i${bits}> [[TMP]], <${n} x i${bits}> {{.*}}, <${n} x i32> zeroinitializer
30-
% if totalBits == 64:
31-
// CHECK-arm64-NEXT: ret <${n} x i${bits}> [[REP]]
32-
% else:
33-
// CHECK-NEXT: ret <${n} x i${bits}> [[REP]]
34-
% end
3530

3631
% end
3732
% end

test/stdlib/SIMDSignedInitializers.swift.gyb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,14 @@ import Swift
2020
% n = totalBits // bits
2121
% if n != 1:
2222
% neonSuffix = str(n) + {8:'b',16:'h',32:'s',64:'d'}[bits]
23-
2423
func repeating${n}_int${bits}(_ scalar: Int${bits}) -> SIMD${n}<Int${bits}> {
2524
SIMD${n}(repeating: scalar)
2625
}
2726
// CHECK: repeating${n}_int${bits}{{.*}} {
2827
// CHECK: entry:
2928
// CHECK: [[TMP:%[0-9]+]] = insertelement <${n} x i${bits}> {{.*}}, i${bits} %0, i32 0
3029
// CHECK-NEXT: [[REP:%[0-9]+]] = shufflevector <${n} x i${bits}> [[TMP]], <${n} x i${bits}> {{.*}}, <${n} x i32> zeroinitializer
31-
% if totalBits == 64:
32-
// CHECK-arm64-NEXT: ret <${n} x i${bits}> [[REP]]
33-
% else:
34-
// CHECK-NEXT: ret <${n} x i${bits}> [[REP]]
35-
% end
30+
3631
% end
3732
% end
3833
%end

test/stdlib/SIMDUnsignedInitializers.swift.gyb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,14 @@ import Swift
2020
% n = totalBits // bits
2121
% if n != 1:
2222
% neonSuffix = str(n) + {8:'b',16:'h',32:'s',64:'d'}[bits]
23-
2423
func repeating${n}_uint${bits}(_ scalar: UInt${bits}) -> SIMD${n}<UInt${bits}> {
2524
SIMD${n}(repeating: scalar)
2625
}
2726
// CHECK: repeating${n}_uint${bits}{{.*}} {
2827
// CHECK: entry:
2928
// CHECK: [[TMP:%[0-9]+]] = insertelement <${n} x i${bits}> {{.*}}, i${bits} %{{.*}}, i32 0
3029
// CHECK-NEXT: [[REP:%[0-9]+]] = shufflevector <${n} x i${bits}> [[TMP]], <${n} x i${bits}> {{.*}}, <${n} x i32> zeroinitializer
31-
% if totalBits == 64:
32-
// CHECK-arm64-NEXT: ret <${n} x i${bits}> [[REP]]
33-
% else:
34-
// CHECK-NEXT: ret <${n} x i${bits}> [[REP]]
35-
% end
30+
3631
% end
3732
% end
3833
%end

0 commit comments

Comments
 (0)