1
1
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2
- ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
2
+ ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s --check-prefixes=CHECK,CONSTVEC
3
+ ; RUN: opt < %s -passes=instsimplify -use-constant-fp-for-fixed-length-splat -use-constant-int-for-fixed-length-splat -S | FileCheck %s --check-prefixes=CHECK,CONSTSPLAT
3
4
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-f64:32:64-v64:64:64-v128:128:128"
4
5
5
6
define <2 x i64 > @test1 () {
@@ -67,43 +68,59 @@ define <4 x i32> @test8(<1 x i64> %y) {
67
68
}
68
69
69
70
define <4 x i32 > @test9 (<1 x i64 > %y ) {
70
- ; CHECK-LABEL: @test9(
71
- ; CHECK-NEXT: ret <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
71
+ ; CONSTVEC-LABEL: @test9(
72
+ ; CONSTVEC-NEXT: ret <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
73
+ ;
74
+ ; CONSTSPLAT-LABEL: @test9(
75
+ ; CONSTSPLAT-NEXT: ret <4 x i32> splat (i32 -1)
72
76
;
73
77
%c = bitcast <2 x i64 > <i64 -1 , i64 -1 > to <4 x i32 >
74
78
ret <4 x i32 > %c
75
79
}
76
80
77
81
define <1 x i1 > @test10 () {
78
- ; CHECK-LABEL: @test10(
79
- ; CHECK-NEXT: [[RET:%.*]] = icmp eq <1 x i64> <i64 bitcast (<1 x double> <double 0xFFFFFFFFFFFFFFFF> to i64)>, zeroinitializer
80
- ; CHECK-NEXT: ret <1 x i1> [[RET]]
82
+ ; CONSTVEC-LABEL: @test10(
83
+ ; CONSTVEC-NEXT: [[RET:%.*]] = icmp eq <1 x i64> <i64 bitcast (<1 x double> <double 0xFFFFFFFFFFFFFFFF> to i64)>, zeroinitializer
84
+ ; CONSTVEC-NEXT: ret <1 x i1> [[RET]]
85
+ ;
86
+ ; CONSTSPLAT-LABEL: @test10(
87
+ ; CONSTSPLAT-NEXT: [[RET:%.*]] = icmp eq <1 x i64> splat (i64 -1), zeroinitializer
88
+ ; CONSTSPLAT-NEXT: ret <1 x i1> [[RET]]
81
89
;
82
90
%ret = icmp eq <1 x i64 > <i64 bitcast (<1 x double > <double 0xFFFFFFFFFFFFFFFF > to i64 )>, zeroinitializer
83
91
ret <1 x i1 > %ret
84
92
}
85
93
86
94
; from MultiSource/Benchmarks/Bullet
87
95
define <2 x float > @foo () {
88
- ; CHECK-LABEL: @foo(
89
- ; CHECK-NEXT: ret <2 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>
96
+ ; CONSTVEC-LABEL: @foo(
97
+ ; CONSTVEC-NEXT: ret <2 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>
98
+ ;
99
+ ; CONSTSPLAT-LABEL: @foo(
100
+ ; CONSTSPLAT-NEXT: ret <2 x float> splat (float 0xFFFFFFFFE0000000)
90
101
;
91
102
%cast = bitcast i64 -1 to <2 x float >
92
103
ret <2 x float > %cast
93
104
}
94
105
95
106
96
107
define <2 x double > @foo2 () {
97
- ; CHECK-LABEL: @foo2(
98
- ; CHECK-NEXT: ret <2 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>
108
+ ; CONSTVEC-LABEL: @foo2(
109
+ ; CONSTVEC-NEXT: ret <2 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>
110
+ ;
111
+ ; CONSTSPLAT-LABEL: @foo2(
112
+ ; CONSTSPLAT-NEXT: ret <2 x double> splat (double 0xFFFFFFFFFFFFFFFF)
99
113
;
100
114
%cast = bitcast i128 -1 to <2 x double >
101
115
ret <2 x double > %cast
102
116
}
103
117
104
118
define <1 x float > @foo3 () {
105
- ; CHECK-LABEL: @foo3(
106
- ; CHECK-NEXT: ret <1 x float> <float 0xFFFFFFFFE0000000>
119
+ ; CONSTVEC-LABEL: @foo3(
120
+ ; CONSTVEC-NEXT: ret <1 x float> <float 0xFFFFFFFFE0000000>
121
+ ;
122
+ ; CONSTSPLAT-LABEL: @foo3(
123
+ ; CONSTSPLAT-NEXT: ret <1 x float> splat (float 0xFFFFFFFFE0000000)
107
124
;
108
125
%cast = bitcast i32 -1 to <1 x float >
109
126
ret <1 x float > %cast
@@ -126,8 +143,11 @@ define double @foo5() {
126
143
}
127
144
128
145
define <2 x double > @foo6 () {
129
- ; CHECK-LABEL: @foo6(
130
- ; CHECK-NEXT: ret <2 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>
146
+ ; CONSTVEC-LABEL: @foo6(
147
+ ; CONSTVEC-NEXT: ret <2 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>
148
+ ;
149
+ ; CONSTSPLAT-LABEL: @foo6(
150
+ ; CONSTSPLAT-NEXT: ret <2 x double> splat (double 0xFFFFFFFFFFFFFFFF)
131
151
;
132
152
%cast = bitcast <4 x i32 ><i32 -1 , i32 -1 , i32 -1 , i32 -1 > to <2 x double >
133
153
ret <2 x double > %cast
@@ -276,3 +296,14 @@ define <16 x i8> @bitcast_constexpr_16i8_8i16_u256uuu256uu() {
276
296
%cast = bitcast <8 x i16 ><i16 undef , i16 256 , i16 undef , i16 undef , i16 undef , i16 256 , i16 undef , i16 undef > to <16 x i8 >
277
297
ret <16 x i8 > %cast
278
298
}
299
+
300
+ define <1 x i32 > @bitcast_constexpr_scalar_fp_to_vector_int () {
301
+ ; CONSTVEC-LABEL: @bitcast_constexpr_scalar_fp_to_vector_int(
302
+ ; CONSTVEC-NEXT: ret <1 x i32> <i32 1065353216>
303
+ ;
304
+ ; CONSTSPLAT-LABEL: @bitcast_constexpr_scalar_fp_to_vector_int(
305
+ ; CONSTSPLAT-NEXT: ret <1 x i32> bitcast (<1 x float> splat (float 1.000000e+00) to <1 x i32>)
306
+ ;
307
+ %res = bitcast float 1 .0 to <1 x i32 >
308
+ ret <1 x i32 > %res
309
+ }
0 commit comments