@@ -128,30 +128,23 @@ define i32 @and_neg_select_pos_i32(i1 %a0, i32 inreg %a1) nounwind {
128
128
define i16 @and_select_neg_i16 (i1 %a0 , i16 %a1 ) nounwind {
129
129
; X86-LABEL: and_select_neg_i16:
130
130
; X86: # %bb.0:
131
- ; X86-NEXT: pushl %esi
132
- ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
133
- ; X86-NEXT: andb $1, %cl
134
- ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
135
- ; X86-NEXT: movl %edx, %esi
136
- ; X86-NEXT: negl %esi
137
- ; X86-NEXT: xorl %eax, %eax
138
- ; X86-NEXT: cmpb $1, %cl
139
- ; X86-NEXT: sbbl %eax, %eax
140
- ; X86-NEXT: orl %esi, %eax
141
- ; X86-NEXT: andl %edx, %eax
131
+ ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
132
+ ; X86-NEXT: movl %ecx, %edx
133
+ ; X86-NEXT: negl %edx
134
+ ; X86-NEXT: testb $1, {{[0-9]+}}(%esp)
135
+ ; X86-NEXT: movw $-1, %ax
136
+ ; X86-NEXT: cmovnew %dx, %ax
137
+ ; X86-NEXT: andl %ecx, %eax
142
138
; X86-NEXT: # kill: def $ax killed $ax killed $eax
143
- ; X86-NEXT: popl %esi
144
139
; X86-NEXT: retl
145
140
;
146
141
; X64-LABEL: and_select_neg_i16:
147
142
; X64: # %bb.0:
148
- ; X64-NEXT: andb $1, %dil
149
143
; X64-NEXT: movl %esi, %ecx
150
144
; X64-NEXT: negl %ecx
151
- ; X64-NEXT: xorl %eax, %eax
152
- ; X64-NEXT: cmpb $1, %dil
153
- ; X64-NEXT: sbbl %eax, %eax
154
- ; X64-NEXT: orl %ecx, %eax
145
+ ; X64-NEXT: testb $1, %dil
146
+ ; X64-NEXT: movw $-1, %ax
147
+ ; X64-NEXT: cmovnew %cx, %ax
155
148
; X64-NEXT: andl %esi, %eax
156
149
; X64-NEXT: # kill: def $ax killed $ax killed $eax
157
150
; X64-NEXT: retq
@@ -200,22 +193,17 @@ define <4 x i32> @and_select_neg_v4xi32(i1 %a0, <4 x i32> %a1) nounwind {
200
193
define i32 @and_select_no_neg (i1 %a0 , i32 inreg %a1 ) nounwind {
201
194
; X86-LABEL: and_select_no_neg:
202
195
; X86: # %bb.0:
203
- ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
204
- ; X86-NEXT: andb $1, %cl
205
- ; X86-NEXT: xorl %edx, %edx
206
- ; X86-NEXT: cmpb $1, %cl
207
- ; X86-NEXT: sbbl %edx, %edx
208
- ; X86-NEXT: orl %eax, %edx
209
- ; X86-NEXT: andl %edx, %eax
196
+ ; X86-NEXT: testb $1, {{[0-9]+}}(%esp)
197
+ ; X86-NEXT: movl $-1, %ecx
198
+ ; X86-NEXT: cmovnel %eax, %ecx
199
+ ; X86-NEXT: andl %ecx, %eax
210
200
; X86-NEXT: retl
211
201
;
212
202
; X64-LABEL: and_select_no_neg:
213
203
; X64: # %bb.0:
214
- ; X64-NEXT: andb $1, %dil
215
- ; X64-NEXT: xorl %eax, %eax
216
- ; X64-NEXT: cmpb $1, %dil
217
- ; X64-NEXT: sbbl %eax, %eax
218
- ; X64-NEXT: orl %esi, %eax
204
+ ; X64-NEXT: testb $1, %dil
205
+ ; X64-NEXT: movl $-1, %eax
206
+ ; X64-NEXT: cmovnel %esi, %eax
219
207
; X64-NEXT: andl %esi, %eax
220
208
; X64-NEXT: retq
221
209
%sub = sub i32 %a1 , 0
@@ -255,26 +243,19 @@ define i32 @and_select_neg_wrong_const(i1 %a0, i32 inreg %a1) nounwind {
255
243
define i32 @and_select_neg_different_op (i1 %a0 , i32 inreg %a1 , i32 inreg %a2 ) nounwind {
256
244
; X86-LABEL: and_select_neg_different_op:
257
245
; X86: # %bb.0:
258
- ; X86-NEXT: pushl %esi
259
- ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
260
- ; X86-NEXT: andb $1, %cl
261
246
; X86-NEXT: negl %edx
262
- ; X86-NEXT: xorl %esi, %esi
263
- ; X86-NEXT: cmpb $1, %cl
264
- ; X86-NEXT: sbbl %esi, %esi
265
- ; X86-NEXT: orl %edx, %esi
266
- ; X86-NEXT: andl %esi, %eax
267
- ; X86-NEXT: popl %esi
247
+ ; X86-NEXT: testb $1, {{[0-9]+}}(%esp)
248
+ ; X86-NEXT: movl $-1, %ecx
249
+ ; X86-NEXT: cmovnel %edx, %ecx
250
+ ; X86-NEXT: andl %ecx, %eax
268
251
; X86-NEXT: retl
269
252
;
270
253
; X64-LABEL: and_select_neg_different_op:
271
254
; X64: # %bb.0:
272
- ; X64-NEXT: andb $1, %dil
273
255
; X64-NEXT: negl %edx
274
- ; X64-NEXT: xorl %eax, %eax
275
- ; X64-NEXT: cmpb $1, %dil
276
- ; X64-NEXT: sbbl %eax, %eax
277
- ; X64-NEXT: orl %edx, %eax
256
+ ; X64-NEXT: testb $1, %dil
257
+ ; X64-NEXT: movl $-1, %eax
258
+ ; X64-NEXT: cmovnel %edx, %eax
278
259
; X64-NEXT: andl %esi, %eax
279
260
; X64-NEXT: retq
280
261
%sub = sub i32 0 , %a2
@@ -427,29 +408,22 @@ define i64 @and_select_sub_1_to_blsr_i64(i1 %a0, i64 %a1) nounwind {
427
408
define i16 @and_select_sub_1_i16 (i1 %a0 , i16 %a1 ) nounwind {
428
409
; X86-LABEL: and_select_sub_1_i16:
429
410
; X86: # %bb.0:
430
- ; X86-NEXT: pushl %esi
431
- ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
432
- ; X86-NEXT: andb $1, %cl
433
- ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
434
- ; X86-NEXT: leal -1(%edx), %esi
435
- ; X86-NEXT: xorl %eax, %eax
436
- ; X86-NEXT: cmpb $1, %cl
437
- ; X86-NEXT: sbbl %eax, %eax
438
- ; X86-NEXT: orl %esi, %eax
439
- ; X86-NEXT: andl %edx, %eax
411
+ ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
412
+ ; X86-NEXT: leal -1(%ecx), %edx
413
+ ; X86-NEXT: testb $1, {{[0-9]+}}(%esp)
414
+ ; X86-NEXT: movw $-1, %ax
415
+ ; X86-NEXT: cmovnew %dx, %ax
416
+ ; X86-NEXT: andl %ecx, %eax
440
417
; X86-NEXT: # kill: def $ax killed $ax killed $eax
441
- ; X86-NEXT: popl %esi
442
418
; X86-NEXT: retl
443
419
;
444
420
; X64-LABEL: and_select_sub_1_i16:
445
421
; X64: # %bb.0:
446
422
; X64-NEXT: # kill: def $esi killed $esi def $rsi
447
- ; X64-NEXT: andb $1, %dil
448
423
; X64-NEXT: leal -1(%rsi), %ecx
449
- ; X64-NEXT: xorl %eax, %eax
450
- ; X64-NEXT: cmpb $1, %dil
451
- ; X64-NEXT: sbbl %eax, %eax
452
- ; X64-NEXT: orl %ecx, %eax
424
+ ; X64-NEXT: testb $1, %dil
425
+ ; X64-NEXT: movw $-1, %ax
426
+ ; X64-NEXT: cmovnew %cx, %ax
453
427
; X64-NEXT: andl %esi, %eax
454
428
; X64-NEXT: # kill: def $ax killed $ax killed $eax
455
429
; X64-NEXT: retq
@@ -492,27 +466,20 @@ define <4 x i32> @and_select_sub_1_v4xi32(i1 %a0, <4 x i32> %a1) nounwind {
492
466
define i32 @and_select_no_sub_1 (i1 %a0 , i32 inreg %a1 ) nounwind {
493
467
; X86-LABEL: and_select_no_sub_1:
494
468
; X86: # %bb.0:
495
- ; X86-NEXT: pushl %esi
496
- ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
497
- ; X86-NEXT: andb $1, %cl
498
- ; X86-NEXT: leal -2(%eax), %edx
499
- ; X86-NEXT: xorl %esi, %esi
500
- ; X86-NEXT: cmpb $1, %cl
501
- ; X86-NEXT: sbbl %esi, %esi
502
- ; X86-NEXT: orl %edx, %esi
503
- ; X86-NEXT: andl %esi, %eax
504
- ; X86-NEXT: popl %esi
469
+ ; X86-NEXT: leal -2(%eax), %ecx
470
+ ; X86-NEXT: testb $1, {{[0-9]+}}(%esp)
471
+ ; X86-NEXT: movl $-1, %edx
472
+ ; X86-NEXT: cmovnel %ecx, %edx
473
+ ; X86-NEXT: andl %edx, %eax
505
474
; X86-NEXT: retl
506
475
;
507
476
; X64-LABEL: and_select_no_sub_1:
508
477
; X64: # %bb.0:
509
478
; X64-NEXT: # kill: def $esi killed $esi def $rsi
510
- ; X64-NEXT: andb $1, %dil
511
479
; X64-NEXT: leal -2(%rsi), %ecx
512
- ; X64-NEXT: xorl %eax, %eax
513
- ; X64-NEXT: cmpb $1, %dil
514
- ; X64-NEXT: sbbl %eax, %eax
515
- ; X64-NEXT: orl %ecx, %eax
480
+ ; X64-NEXT: testb $1, %dil
481
+ ; X64-NEXT: movl $-1, %eax
482
+ ; X64-NEXT: cmovnel %ecx, %eax
516
483
; X64-NEXT: andl %esi, %eax
517
484
; X64-NEXT: retq
518
485
%sub = add i32 %a1 , -2
@@ -551,27 +518,20 @@ define i32 @and_select_sub_1_wrong_const(i1 %a0, i32 inreg %a1) nounwind {
551
518
define i32 @and_select_sub_1_different_op (i1 %a0 , i32 inreg %a1 , i32 inreg %a2 ) nounwind {
552
519
; X86-LABEL: and_select_sub_1_different_op:
553
520
; X86: # %bb.0:
554
- ; X86-NEXT: pushl %esi
555
- ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
556
- ; X86-NEXT: andb $1, %cl
557
- ; X86-NEXT: decl %edx
558
- ; X86-NEXT: xorl %esi, %esi
559
- ; X86-NEXT: cmpb $1, %cl
560
- ; X86-NEXT: sbbl %esi, %esi
561
- ; X86-NEXT: orl %edx, %esi
562
- ; X86-NEXT: andl %esi, %eax
563
- ; X86-NEXT: popl %esi
521
+ ; X86-NEXT: leal -1(%edx), %ecx
522
+ ; X86-NEXT: testb $1, {{[0-9]+}}(%esp)
523
+ ; X86-NEXT: movl $-1, %edx
524
+ ; X86-NEXT: cmovnel %ecx, %edx
525
+ ; X86-NEXT: andl %edx, %eax
564
526
; X86-NEXT: retl
565
527
;
566
528
; X64-LABEL: and_select_sub_1_different_op:
567
529
; X64: # %bb.0:
568
530
; X64-NEXT: # kill: def $edx killed $edx def $rdx
569
- ; X64-NEXT: andb $1, %dil
570
531
; X64-NEXT: leal -1(%rdx), %ecx
571
- ; X64-NEXT: xorl %eax, %eax
572
- ; X64-NEXT: cmpb $1, %dil
573
- ; X64-NEXT: sbbl %eax, %eax
574
- ; X64-NEXT: orl %ecx, %eax
532
+ ; X64-NEXT: testb $1, %dil
533
+ ; X64-NEXT: movl $-1, %eax
534
+ ; X64-NEXT: cmovnel %ecx, %eax
575
535
; X64-NEXT: andl %esi, %eax
576
536
; X64-NEXT: retq
577
537
%sub = add i32 %a2 , -1
@@ -809,27 +769,20 @@ define i32 @xor_select_no_sub_1(i1 %a0, i32 inreg %a1) nounwind {
809
769
define i32 @xor_select_sub_1_wrong_const (i1 %a0 , i32 inreg %a1 ) nounwind {
810
770
; X86-LABEL: xor_select_sub_1_wrong_const:
811
771
; X86: # %bb.0:
812
- ; X86-NEXT: pushl %esi
813
- ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
814
- ; X86-NEXT: andb $1, %cl
815
- ; X86-NEXT: leal -1(%eax), %edx
816
- ; X86-NEXT: xorl %esi, %esi
817
- ; X86-NEXT: cmpb $1, %cl
818
- ; X86-NEXT: sbbl %esi, %esi
819
- ; X86-NEXT: orl %edx, %esi
820
- ; X86-NEXT: xorl %esi, %eax
821
- ; X86-NEXT: popl %esi
772
+ ; X86-NEXT: leal -1(%eax), %ecx
773
+ ; X86-NEXT: testb $1, {{[0-9]+}}(%esp)
774
+ ; X86-NEXT: movl $-1, %edx
775
+ ; X86-NEXT: cmovnel %ecx, %edx
776
+ ; X86-NEXT: xorl %edx, %eax
822
777
; X86-NEXT: retl
823
778
;
824
779
; X64-LABEL: xor_select_sub_1_wrong_const:
825
780
; X64: # %bb.0:
826
781
; X64-NEXT: # kill: def $esi killed $esi def $rsi
827
- ; X64-NEXT: andb $1, %dil
828
782
; X64-NEXT: leal -1(%rsi), %ecx
829
- ; X64-NEXT: xorl %eax, %eax
830
- ; X64-NEXT: cmpb $1, %dil
831
- ; X64-NEXT: sbbl %eax, %eax
832
- ; X64-NEXT: orl %ecx, %eax
783
+ ; X64-NEXT: testb $1, %dil
784
+ ; X64-NEXT: movl $-1, %eax
785
+ ; X64-NEXT: cmovnel %ecx, %eax
833
786
; X64-NEXT: xorl %esi, %eax
834
787
; X64-NEXT: retq
835
788
%sub = add i32 %a1 , -1
0 commit comments