@@ -41,11 +41,7 @@ define float @test_simplify1(float %x) {
41
41
42
42
define <2 x float > @test_simplify1v (<2 x float > %x ) {
43
43
; CHECK-LABEL: @test_simplify1v(
44
- ; ANY-NEXT: ret <2 x float> <float 1.000000e+00, float 1.000000e+00>
45
- ; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 1.000000e+00, float 1.000000e+00>, <2 x float> [[X:%.*]])
46
- ; MSVC-NEXT: ret <2 x float> [[POW]]
47
- ; NOLIB-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 1.000000e+00, float 1.000000e+00>, <2 x float> [[X:%.*]])
48
- ; NOLIB-NEXT: ret <2 x float> [[POW]]
44
+ ; CHECK-NEXT: ret <2 x float> <float 1.000000e+00, float 1.000000e+00>
49
45
;
50
46
%retval = call <2 x float > @llvm.pow.v2f32 (<2 x float > <float 1 .0 , float 1 .0 >, <2 x float > %x )
51
47
ret <2 x float > %retval
@@ -63,11 +59,7 @@ define double @test_simplify2(double %x) {
63
59
64
60
define <2 x double > @test_simplify2v (<2 x double > %x ) {
65
61
; CHECK-LABEL: @test_simplify2v(
66
- ; ANY-NEXT: ret <2 x double> <double 1.000000e+00, double 1.000000e+00>
67
- ; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double> [[X:%.*]])
68
- ; MSVC-NEXT: ret <2 x double> [[POW]]
69
- ; NOLIB-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double> [[X:%.*]])
70
- ; NOLIB-NEXT: ret <2 x double> [[POW]]
62
+ ; CHECK-NEXT: ret <2 x double> <double 1.000000e+00, double 1.000000e+00>
71
63
;
72
64
%retval = call <2 x double > @llvm.pow.v2f64 (<2 x double > <double 1 .0 , double 1 .0 >, <2 x double > %x )
73
65
ret <2 x double > %retval
@@ -119,6 +111,7 @@ define <2 x float> @test_simplify3v(<2 x float> %x) {
119
111
; ANY-NEXT: ret <2 x float> [[EXP2]]
120
112
; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 2.000000e+00, float 2.000000e+00>, <2 x float> [[X:%.*]])
121
113
; MSVC-NEXT: ret <2 x float> [[POW]]
114
+ ; TODO: should be able to simplify llvm.pow to llvm.exp2 even without libcalls
122
115
; NOLIB-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 2.000000e+00, float 2.000000e+00>, <2 x float> [[X:%.*]])
123
116
; NOLIB-NEXT: ret <2 x float> [[POW]]
124
117
;
@@ -133,6 +126,7 @@ define <2 x double> @test_simplify3vn(<2 x double> %x) {
133
126
; ANY-NEXT: ret <2 x double> [[EXP2]]
134
127
; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 4.000000e+00, double 4.000000e+00>, <2 x double> [[X:%.*]])
135
128
; MSVC-NEXT: ret <2 x double> [[POW]]
129
+ ; TODO: should be able to simplify llvm.pow to llvm.exp2 even without libcalls
136
130
; NOLIB-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 4.000000e+00, double 4.000000e+00>, <2 x double> [[X:%.*]])
137
131
; NOLIB-NEXT: ret <2 x double> [[POW]]
138
132
;
@@ -184,6 +178,7 @@ define <2 x double> @test_simplify4v(<2 x double> %x) {
184
178
; ANY-NEXT: ret <2 x double> [[EXP2]]
185
179
; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> [[X:%.*]])
186
180
; MSVC-NEXT: ret <2 x double> [[POW]]
181
+ ; TODO: should be able to simplify llvm.pow to llvm.exp2 even without libcalls
187
182
; NOLIB-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> [[X:%.*]])
188
183
; NOLIB-NEXT: ret <2 x double> [[POW]]
189
184
;
@@ -198,6 +193,7 @@ define <2 x float> @test_simplify4vn(<2 x float> %x) {
198
193
; ANY-NEXT: ret <2 x float> [[EXP2]]
199
194
; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 5.000000e-01, float 5.000000e-01>, <2 x float> [[X:%.*]])
200
195
; MSVC-NEXT: ret <2 x float> [[POW]]
196
+ ; TODO: should be able to simplify llvm.pow to llvm.exp2 even without libcalls
201
197
; NOLIB-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 5.000000e-01, float 5.000000e-01>, <2 x float> [[X:%.*]])
202
198
; NOLIB-NEXT: ret <2 x float> [[POW]]
203
199
;
@@ -225,11 +221,7 @@ define float @test_simplify5(float %x) {
225
221
226
222
define <2 x float > @test_simplify5v (<2 x float > %x ) {
227
223
; CHECK-LABEL: @test_simplify5v(
228
- ; ANY-NEXT: ret <2 x float> <float 1.000000e+00, float 1.000000e+00>
229
- ; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> zeroinitializer)
230
- ; MSVC-NEXT: ret <2 x float> [[POW]]
231
- ; NOLIB-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> zeroinitializer)
232
- ; NOLIB-NEXT: ret <2 x float> [[POW]]
224
+ ; CHECK-NEXT: ret <2 x float> <float 1.000000e+00, float 1.000000e+00>
233
225
;
234
226
%retval = call <2 x float > @llvm.pow.v2f32 (<2 x float > %x , <2 x float > <float 0 .0 , float 0 .0 >)
235
227
ret <2 x float > %retval
@@ -247,11 +239,7 @@ define double @test_simplify6(double %x) {
247
239
248
240
define <2 x double > @test_simplify6v (<2 x double > %x ) {
249
241
; CHECK-LABEL: @test_simplify6v(
250
- ; ANY-NEXT: ret <2 x double> <double 1.000000e+00, double 1.000000e+00>
251
- ; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> zeroinitializer)
252
- ; MSVC-NEXT: ret <2 x double> [[POW]]
253
- ; NOLIB-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> zeroinitializer)
254
- ; NOLIB-NEXT: ret <2 x double> [[POW]]
242
+ ; CHECK-NEXT: ret <2 x double> <double 1.000000e+00, double 1.000000e+00>
255
243
;
256
244
%retval = call <2 x double > @llvm.pow.v2f64 (<2 x double > %x , <2 x double > <double 0 .0 , double 0 .0 >)
257
245
ret <2 x double > %retval
@@ -349,11 +337,7 @@ define float @test_simplify11(float %x) {
349
337
350
338
define <2 x float > @test_simplify11v (<2 x float > %x ) {
351
339
; CHECK-LABEL: @test_simplify11v(
352
- ; ANY-NEXT: ret <2 x float> [[X:%.*]]
353
- ; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> <float 1.000000e+00, float 1.000000e+00>)
354
- ; MSVC-NEXT: ret <2 x float> [[POW]]
355
- ; NOLIB-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> <float 1.000000e+00, float 1.000000e+00>)
356
- ; NOLIB-NEXT: ret <2 x float> [[POW]]
340
+ ; CHECK-NEXT: ret <2 x float> [[X:%.*]]
357
341
;
358
342
%retval = call <2 x float > @llvm.pow.v2f32 (<2 x float > %x , <2 x float > <float 1 .0 , float 1 .0 >)
359
343
ret <2 x float > %retval
@@ -371,11 +355,7 @@ define double @test_simplify12(double %x) {
371
355
372
356
define <2 x double > @test_simplify12v (<2 x double > %x ) {
373
357
; CHECK-LABEL: @test_simplify12v(
374
- ; ANY-NEXT: ret <2 x double> [[X:%.*]]
375
- ; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> <double 1.000000e+00, double 1.000000e+00>)
376
- ; MSVC-NEXT: ret <2 x double> [[POW]]
377
- ; NOLIB-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> <double 1.000000e+00, double 1.000000e+00>)
378
- ; NOLIB-NEXT: ret <2 x double> [[POW]]
358
+ ; CHECK-NEXT: ret <2 x double> [[X:%.*]]
379
359
;
380
360
%retval = call <2 x double > @llvm.pow.v2f64 (<2 x double > %x , <2 x double > <double 1 .0 , double 1 .0 >)
381
361
ret <2 x double > %retval
@@ -404,12 +384,8 @@ define float @pow2_strict(float %x) {
404
384
405
385
define <2 x float > @pow2_strictv (<2 x float > %x ) {
406
386
; CHECK-LABEL: @pow2_strictv(
407
- ; ANY-NEXT: [[SQUARE:%.*]] = fmul <2 x float> [[X:%.*]], [[X]]
408
- ; ANY-NEXT: ret <2 x float> [[SQUARE]]
409
- ; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> <float 2.000000e+00, float 2.000000e+00>)
410
- ; MSVC-NEXT: ret <2 x float> [[POW]]
411
- ; NOLIB-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> <float 2.000000e+00, float 2.000000e+00>)
412
- ; NOLIB-NEXT: ret <2 x float> [[POW]]
387
+ ; CHECK-NEXT: [[SQUARE:%.*]] = fmul <2 x float> [[X:%.*]], [[X]]
388
+ ; CHECK-NEXT: ret <2 x float> [[SQUARE]]
413
389
;
414
390
%r = call <2 x float > @llvm.pow.v2f32 (<2 x float > %x , <2 x float > <float 2 .0 , float 2 .0 >)
415
391
ret <2 x float > %r
@@ -428,12 +404,8 @@ define double @pow2_double_strict(double %x) {
428
404
429
405
define <2 x double > @pow2_double_strictv (<2 x double > %x ) {
430
406
; CHECK-LABEL: @pow2_double_strictv(
431
- ; ANY-NEXT: [[SQUARE:%.*]] = fmul <2 x double> [[X:%.*]], [[X]]
432
- ; ANY-NEXT: ret <2 x double> [[SQUARE]]
433
- ; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> <double 2.000000e+00, double 2.000000e+00>)
434
- ; MSVC-NEXT: ret <2 x double> [[POW]]
435
- ; NOLIB-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> <double 2.000000e+00, double 2.000000e+00>)
436
- ; NOLIB-NEXT: ret <2 x double> [[POW]]
407
+ ; CHECK-NEXT: [[SQUARE:%.*]] = fmul <2 x double> [[X:%.*]], [[X]]
408
+ ; CHECK-NEXT: ret <2 x double> [[SQUARE]]
437
409
;
438
410
%r = call <2 x double > @llvm.pow.v2f64 (<2 x double > %x , <2 x double > <double 2 .0 , double 2 .0 >)
439
411
ret <2 x double > %r
@@ -483,12 +455,8 @@ define float @pow_neg1_strict(float %x) {
483
455
484
456
define <2 x float > @pow_neg1_strictv (<2 x float > %x ) {
485
457
; CHECK-LABEL: @pow_neg1_strictv(
486
- ; ANY-NEXT: [[RECIPROCAL:%.*]] = fdiv <2 x float> <float 1.000000e+00, float 1.000000e+00>, [[X:%.*]]
487
- ; ANY-NEXT: ret <2 x float> [[RECIPROCAL]]
488
- ; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> <float -1.000000e+00, float -1.000000e+00>)
489
- ; MSVC-NEXT: ret <2 x float> [[POW]]
490
- ; NOLIB-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> <float -1.000000e+00, float -1.000000e+00>)
491
- ; NOLIB-NEXT: ret <2 x float> [[POW]]
458
+ ; CHECK-NEXT: [[RECIPROCAL:%.*]] = fdiv <2 x float> <float 1.000000e+00, float 1.000000e+00>, [[X:%.*]]
459
+ ; CHECK-NEXT: ret <2 x float> [[RECIPROCAL]]
492
460
;
493
461
%r = call <2 x float > @llvm.pow.v2f32 (<2 x float > %x , <2 x float > <float -1 .0 , float -1 .0 >)
494
462
ret <2 x float > %r
@@ -507,26 +475,20 @@ define double @pow_neg1_double_fast(double %x) {
507
475
508
476
define <2 x double > @pow_neg1_double_fastv (<2 x double > %x ) {
509
477
; CHECK-LABEL: @pow_neg1_double_fastv(
510
- ; ANY-NEXT: [[RECIPROCAL:%.*]] = fdiv fast <2 x double> <double 1.000000e+00, double 1.000000e+00>, [[X:%.*]]
511
- ; ANY-NEXT: ret <2 x double> [[RECIPROCAL]]
512
- ; MSVC-NEXT: [[POW:%.*]] = call fast <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> <double -1.000000e+00, double -1.000000e+00>)
513
- ; MSVC-NEXT: ret <2 x double> [[POW]]
514
- ; NOLIB-NEXT: [[POW:%.*]] = call fast <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> <double -1.000000e+00, double -1.000000e+00>)
515
- ; NOLIB-NEXT: ret <2 x double> [[POW]]
478
+ ; CHECK-NEXT: [[RECIPROCAL:%.*]] = fdiv fast <2 x double> <double 1.000000e+00, double 1.000000e+00>, [[X:%.*]]
479
+ ; CHECK-NEXT: ret <2 x double> [[RECIPROCAL]]
516
480
;
517
481
%r = call fast <2 x double > @llvm.pow.v2f64 (<2 x double > %x , <2 x double > <double -1 .0 , double -1 .0 >)
518
482
ret <2 x double > %r
519
483
}
520
484
521
485
define double @test_simplify17 (double %x ) {
522
486
; CHECK-LABEL: @test_simplify17(
523
- ; LIB-NEXT: [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X:%.*]])
524
- ; LIB-NEXT: [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]])
525
- ; LIB-NEXT: [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000
526
- ; LIB-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]]
527
- ; LIB-NEXT: ret double [[TMP1]]
528
- ; NOLIB-NEXT: [[POW:%.*]] = call double @llvm.pow.f64(double [[X:%.*]], double 5.000000e-01)
529
- ; NOLIB-NEXT: ret double [[POW]]
487
+ ; CHECK-NEXT: [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X:%.*]])
488
+ ; CHECK-NEXT: [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]])
489
+ ; CHECK-NEXT: [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000
490
+ ; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]]
491
+ ; CHECK-NEXT: ret double [[TMP1]]
530
492
;
531
493
%retval = call double @llvm.pow.f64 (double %x , double 0 .5 )
532
494
ret double %retval
0 commit comments