hoist-and-by-const-from-shl-in-eqcmp-zero.ll
35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=armv6 < %s | FileCheck %s --check-prefixes=CHECK,ARM,ARM6
; RUN: llc -mtriple=armv7 < %s | FileCheck %s --check-prefixes=CHECK,ARM,ARM78,ARM7
; RUN: llc -mtriple=armv8a < %s | FileCheck %s --check-prefixes=CHECK,ARM,ARM78,ARM8
; RUN: llc -mtriple=thumbv6 < %s | FileCheck %s --check-prefixes=CHECK,THUMB,THUMB6
; RUN: llc -mtriple=thumbv7 < %s | FileCheck %s --check-prefixes=CHECK,THUMB,THUMB78,THUMB7
; RUN: llc -mtriple=thumbv8-eabi < %s | FileCheck %s --check-prefixes=CHECK,THUMB,THUMB78,THUMB8
; We are looking for the following pattern here:
; (X & (C << Y)) ==/!= 0
; It may be optimal to hoist the constant:
; ((X l>> Y) & C) ==/!= 0
;------------------------------------------------------------------------------;
; A few scalar test
;------------------------------------------------------------------------------;
; i8 scalar
define i1 @scalar_i8_signbit_eq(i8 %x, i8 %y) nounwind {
; ARM-LABEL: scalar_i8_signbit_eq:
; ARM: @ %bb.0:
; ARM-NEXT: uxtb r1, r1
; ARM-NEXT: uxtb r0, r0
; ARM-NEXT: lsr r0, r0, r1
; ARM-NEXT: mov r1, #1
; ARM-NEXT: eor r0, r1, r0, lsr #7
; ARM-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i8_signbit_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: uxtb r1, r1
; THUMB6-NEXT: uxtb r0, r0
; THUMB6-NEXT: lsrs r0, r1
; THUMB6-NEXT: movs r1, #128
; THUMB6-NEXT: ands r1, r0
; THUMB6-NEXT: rsbs r0, r1, #0
; THUMB6-NEXT: adcs r0, r1
; THUMB6-NEXT: bx lr
;
; THUMB7-LABEL: scalar_i8_signbit_eq:
; THUMB7: @ %bb.0:
; THUMB7-NEXT: uxtb r1, r1
; THUMB7-NEXT: uxtb r0, r0
; THUMB7-NEXT: lsrs r0, r1
; THUMB7-NEXT: movs r1, #1
; THUMB7-NEXT: eor.w r0, r1, r0, lsr #7
; THUMB7-NEXT: bx lr
;
; THUMB8-LABEL: scalar_i8_signbit_eq:
; THUMB8: @ %bb.0:
; THUMB8-NEXT: uxtb r0, r0
; THUMB8-NEXT: uxtb r1, r1
; THUMB8-NEXT: lsrs r0, r1
; THUMB8-NEXT: movs r1, #1
; THUMB8-NEXT: eor.w r0, r1, r0, lsr #7
; THUMB8-NEXT: bx lr
%t0 = shl i8 128, %y
%t1 = and i8 %t0, %x
%res = icmp eq i8 %t1, 0
ret i1 %res
}
define i1 @scalar_i8_lowestbit_eq(i8 %x, i8 %y) nounwind {
; ARM-LABEL: scalar_i8_lowestbit_eq:
; ARM: @ %bb.0:
; ARM-NEXT: uxtb r1, r1
; ARM-NEXT: uxtb r0, r0
; ARM-NEXT: mov r2, #1
; ARM-NEXT: bic r0, r2, r0, lsr r1
; ARM-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i8_lowestbit_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: uxtb r1, r1
; THUMB6-NEXT: uxtb r0, r0
; THUMB6-NEXT: lsrs r0, r1
; THUMB6-NEXT: movs r1, #1
; THUMB6-NEXT: ands r1, r0
; THUMB6-NEXT: rsbs r0, r1, #0
; THUMB6-NEXT: adcs r0, r1
; THUMB6-NEXT: bx lr
;
; THUMB7-LABEL: scalar_i8_lowestbit_eq:
; THUMB7: @ %bb.0:
; THUMB7-NEXT: uxtb r1, r1
; THUMB7-NEXT: uxtb r0, r0
; THUMB7-NEXT: lsrs r0, r1
; THUMB7-NEXT: movs r1, #1
; THUMB7-NEXT: bic.w r0, r1, r0
; THUMB7-NEXT: bx lr
;
; THUMB8-LABEL: scalar_i8_lowestbit_eq:
; THUMB8: @ %bb.0:
; THUMB8-NEXT: uxtb r0, r0
; THUMB8-NEXT: uxtb r1, r1
; THUMB8-NEXT: lsrs r0, r1
; THUMB8-NEXT: movs r1, #1
; THUMB8-NEXT: bic.w r0, r1, r0
; THUMB8-NEXT: bx lr
%t0 = shl i8 1, %y
%t1 = and i8 %t0, %x
%res = icmp eq i8 %t1, 0
ret i1 %res
}
define i1 @scalar_i8_bitsinmiddle_eq(i8 %x, i8 %y) nounwind {
; ARM-LABEL: scalar_i8_bitsinmiddle_eq:
; ARM: @ %bb.0:
; ARM-NEXT: uxtb r1, r1
; ARM-NEXT: uxtb r0, r0
; ARM-NEXT: mov r2, #24
; ARM-NEXT: and r0, r2, r0, lsr r1
; ARM-NEXT: clz r0, r0
; ARM-NEXT: lsr r0, r0, #5
; ARM-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i8_bitsinmiddle_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: uxtb r1, r1
; THUMB6-NEXT: uxtb r0, r0
; THUMB6-NEXT: lsrs r0, r1
; THUMB6-NEXT: movs r1, #24
; THUMB6-NEXT: ands r1, r0
; THUMB6-NEXT: rsbs r0, r1, #0
; THUMB6-NEXT: adcs r0, r1
; THUMB6-NEXT: bx lr
;
; THUMB7-LABEL: scalar_i8_bitsinmiddle_eq:
; THUMB7: @ %bb.0:
; THUMB7-NEXT: uxtb r1, r1
; THUMB7-NEXT: uxtb r0, r0
; THUMB7-NEXT: lsrs r0, r1
; THUMB7-NEXT: and r0, r0, #24
; THUMB7-NEXT: clz r0, r0
; THUMB7-NEXT: lsrs r0, r0, #5
; THUMB7-NEXT: bx lr
;
; THUMB8-LABEL: scalar_i8_bitsinmiddle_eq:
; THUMB8: @ %bb.0:
; THUMB8-NEXT: uxtb r0, r0
; THUMB8-NEXT: uxtb r1, r1
; THUMB8-NEXT: lsrs r0, r1
; THUMB8-NEXT: and r0, r0, #24
; THUMB8-NEXT: clz r0, r0
; THUMB8-NEXT: lsrs r0, r0, #5
; THUMB8-NEXT: bx lr
%t0 = shl i8 24, %y
%t1 = and i8 %t0, %x
%res = icmp eq i8 %t1, 0
ret i1 %res
}
; i16 scalar
define i1 @scalar_i16_signbit_eq(i16 %x, i16 %y) nounwind {
; ARM-LABEL: scalar_i16_signbit_eq:
; ARM: @ %bb.0:
; ARM-NEXT: uxth r1, r1
; ARM-NEXT: uxth r0, r0
; ARM-NEXT: lsr r0, r0, r1
; ARM-NEXT: mov r1, #1
; ARM-NEXT: eor r0, r1, r0, lsr #15
; ARM-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i16_signbit_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: uxth r1, r1
; THUMB6-NEXT: uxth r0, r0
; THUMB6-NEXT: lsrs r0, r1
; THUMB6-NEXT: movs r1, #1
; THUMB6-NEXT: lsls r1, r1, #15
; THUMB6-NEXT: ands r1, r0
; THUMB6-NEXT: rsbs r0, r1, #0
; THUMB6-NEXT: adcs r0, r1
; THUMB6-NEXT: bx lr
;
; THUMB7-LABEL: scalar_i16_signbit_eq:
; THUMB7: @ %bb.0:
; THUMB7-NEXT: uxth r1, r1
; THUMB7-NEXT: uxth r0, r0
; THUMB7-NEXT: lsrs r0, r1
; THUMB7-NEXT: movs r1, #1
; THUMB7-NEXT: eor.w r0, r1, r0, lsr #15
; THUMB7-NEXT: bx lr
;
; THUMB8-LABEL: scalar_i16_signbit_eq:
; THUMB8: @ %bb.0:
; THUMB8-NEXT: uxth r0, r0
; THUMB8-NEXT: uxth r1, r1
; THUMB8-NEXT: lsrs r0, r1
; THUMB8-NEXT: movs r1, #1
; THUMB8-NEXT: eor.w r0, r1, r0, lsr #15
; THUMB8-NEXT: bx lr
%t0 = shl i16 32768, %y
%t1 = and i16 %t0, %x
%res = icmp eq i16 %t1, 0
ret i1 %res
}
define i1 @scalar_i16_lowestbit_eq(i16 %x, i16 %y) nounwind {
; ARM-LABEL: scalar_i16_lowestbit_eq:
; ARM: @ %bb.0:
; ARM-NEXT: uxth r1, r1
; ARM-NEXT: uxth r0, r0
; ARM-NEXT: mov r2, #1
; ARM-NEXT: bic r0, r2, r0, lsr r1
; ARM-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i16_lowestbit_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: uxth r1, r1
; THUMB6-NEXT: uxth r0, r0
; THUMB6-NEXT: lsrs r0, r1
; THUMB6-NEXT: movs r1, #1
; THUMB6-NEXT: ands r1, r0
; THUMB6-NEXT: rsbs r0, r1, #0
; THUMB6-NEXT: adcs r0, r1
; THUMB6-NEXT: bx lr
;
; THUMB7-LABEL: scalar_i16_lowestbit_eq:
; THUMB7: @ %bb.0:
; THUMB7-NEXT: uxth r1, r1
; THUMB7-NEXT: uxth r0, r0
; THUMB7-NEXT: lsrs r0, r1
; THUMB7-NEXT: movs r1, #1
; THUMB7-NEXT: bic.w r0, r1, r0
; THUMB7-NEXT: bx lr
;
; THUMB8-LABEL: scalar_i16_lowestbit_eq:
; THUMB8: @ %bb.0:
; THUMB8-NEXT: uxth r0, r0
; THUMB8-NEXT: uxth r1, r1
; THUMB8-NEXT: lsrs r0, r1
; THUMB8-NEXT: movs r1, #1
; THUMB8-NEXT: bic.w r0, r1, r0
; THUMB8-NEXT: bx lr
%t0 = shl i16 1, %y
%t1 = and i16 %t0, %x
%res = icmp eq i16 %t1, 0
ret i1 %res
}
define i1 @scalar_i16_bitsinmiddle_eq(i16 %x, i16 %y) nounwind {
; ARM-LABEL: scalar_i16_bitsinmiddle_eq:
; ARM: @ %bb.0:
; ARM-NEXT: uxth r1, r1
; ARM-NEXT: uxth r0, r0
; ARM-NEXT: mov r2, #4080
; ARM-NEXT: and r0, r2, r0, lsr r1
; ARM-NEXT: clz r0, r0
; ARM-NEXT: lsr r0, r0, #5
; ARM-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i16_bitsinmiddle_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: uxth r1, r1
; THUMB6-NEXT: uxth r0, r0
; THUMB6-NEXT: lsrs r0, r1
; THUMB6-NEXT: movs r1, #255
; THUMB6-NEXT: lsls r1, r1, #4
; THUMB6-NEXT: ands r1, r0
; THUMB6-NEXT: rsbs r0, r1, #0
; THUMB6-NEXT: adcs r0, r1
; THUMB6-NEXT: bx lr
;
; THUMB7-LABEL: scalar_i16_bitsinmiddle_eq:
; THUMB7: @ %bb.0:
; THUMB7-NEXT: uxth r1, r1
; THUMB7-NEXT: uxth r0, r0
; THUMB7-NEXT: lsrs r0, r1
; THUMB7-NEXT: and r0, r0, #4080
; THUMB7-NEXT: clz r0, r0
; THUMB7-NEXT: lsrs r0, r0, #5
; THUMB7-NEXT: bx lr
;
; THUMB8-LABEL: scalar_i16_bitsinmiddle_eq:
; THUMB8: @ %bb.0:
; THUMB8-NEXT: uxth r0, r0
; THUMB8-NEXT: uxth r1, r1
; THUMB8-NEXT: lsrs r0, r1
; THUMB8-NEXT: and r0, r0, #4080
; THUMB8-NEXT: clz r0, r0
; THUMB8-NEXT: lsrs r0, r0, #5
; THUMB8-NEXT: bx lr
%t0 = shl i16 4080, %y
%t1 = and i16 %t0, %x
%res = icmp eq i16 %t1, 0
ret i1 %res
}
; i32 scalar
define i1 @scalar_i32_signbit_eq(i32 %x, i32 %y) nounwind {
; ARM-LABEL: scalar_i32_signbit_eq:
; ARM: @ %bb.0:
; ARM-NEXT: mvn r0, r0, lsr r1
; ARM-NEXT: lsr r0, r0, #31
; ARM-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i32_signbit_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: lsrs r0, r1
; THUMB6-NEXT: movs r1, #1
; THUMB6-NEXT: lsls r1, r1, #31
; THUMB6-NEXT: ands r1, r0
; THUMB6-NEXT: rsbs r0, r1, #0
; THUMB6-NEXT: adcs r0, r1
; THUMB6-NEXT: bx lr
;
; THUMB78-LABEL: scalar_i32_signbit_eq:
; THUMB78: @ %bb.0:
; THUMB78-NEXT: lsrs r0, r1
; THUMB78-NEXT: mvns r0, r0
; THUMB78-NEXT: lsrs r0, r0, #31
; THUMB78-NEXT: bx lr
%t0 = shl i32 2147483648, %y
%t1 = and i32 %t0, %x
%res = icmp eq i32 %t1, 0
ret i1 %res
}
define i1 @scalar_i32_lowestbit_eq(i32 %x, i32 %y) nounwind {
; ARM-LABEL: scalar_i32_lowestbit_eq:
; ARM: @ %bb.0:
; ARM-NEXT: mov r2, #1
; ARM-NEXT: bic r0, r2, r0, lsr r1
; ARM-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i32_lowestbit_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: lsrs r0, r1
; THUMB6-NEXT: movs r1, #1
; THUMB6-NEXT: ands r1, r0
; THUMB6-NEXT: rsbs r0, r1, #0
; THUMB6-NEXT: adcs r0, r1
; THUMB6-NEXT: bx lr
;
; THUMB78-LABEL: scalar_i32_lowestbit_eq:
; THUMB78: @ %bb.0:
; THUMB78-NEXT: lsrs r0, r1
; THUMB78-NEXT: movs r1, #1
; THUMB78-NEXT: bic.w r0, r1, r0
; THUMB78-NEXT: bx lr
%t0 = shl i32 1, %y
%t1 = and i32 %t0, %x
%res = icmp eq i32 %t1, 0
ret i1 %res
}
define i1 @scalar_i32_bitsinmiddle_eq(i32 %x, i32 %y) nounwind {
; ARM6-LABEL: scalar_i32_bitsinmiddle_eq:
; ARM6: @ %bb.0:
; ARM6-NEXT: mov r2, #65280
; ARM6-NEXT: orr r2, r2, #16711680
; ARM6-NEXT: and r0, r2, r0, lsr r1
; ARM6-NEXT: clz r0, r0
; ARM6-NEXT: lsr r0, r0, #5
; ARM6-NEXT: bx lr
;
; ARM78-LABEL: scalar_i32_bitsinmiddle_eq:
; ARM78: @ %bb.0:
; ARM78-NEXT: movw r2, #65280
; ARM78-NEXT: movt r2, #255
; ARM78-NEXT: and r0, r2, r0, lsr r1
; ARM78-NEXT: clz r0, r0
; ARM78-NEXT: lsr r0, r0, #5
; ARM78-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i32_bitsinmiddle_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: lsrs r0, r1
; THUMB6-NEXT: ldr r1, .LCPI8_0
; THUMB6-NEXT: ands r1, r0
; THUMB6-NEXT: rsbs r0, r1, #0
; THUMB6-NEXT: adcs r0, r1
; THUMB6-NEXT: bx lr
; THUMB6-NEXT: .p2align 2
; THUMB6-NEXT: @ %bb.1:
; THUMB6-NEXT: .LCPI8_0:
; THUMB6-NEXT: .long 16776960 @ 0xffff00
;
; THUMB78-LABEL: scalar_i32_bitsinmiddle_eq:
; THUMB78: @ %bb.0:
; THUMB78-NEXT: lsrs r0, r1
; THUMB78-NEXT: movw r1, #65280
; THUMB78-NEXT: movt r1, #255
; THUMB78-NEXT: ands r0, r1
; THUMB78-NEXT: clz r0, r0
; THUMB78-NEXT: lsrs r0, r0, #5
; THUMB78-NEXT: bx lr
%t0 = shl i32 16776960, %y
%t1 = and i32 %t0, %x
%res = icmp eq i32 %t1, 0
ret i1 %res
}
; i64 scalar
define i1 @scalar_i64_signbit_eq(i64 %x, i64 %y) nounwind {
; ARM6-LABEL: scalar_i64_signbit_eq:
; ARM6: @ %bb.0:
; ARM6-NEXT: lsr r0, r1, r2
; ARM6-NEXT: subs r1, r2, #32
; ARM6-NEXT: movpl r0, #0
; ARM6-NEXT: mvn r0, r0
; ARM6-NEXT: lsr r0, r0, #31
; ARM6-NEXT: bx lr
;
; ARM78-LABEL: scalar_i64_signbit_eq:
; ARM78: @ %bb.0:
; ARM78-NEXT: lsr r0, r1, r2
; ARM78-NEXT: subs r1, r2, #32
; ARM78-NEXT: movwpl r0, #0
; ARM78-NEXT: mvn r0, r0
; ARM78-NEXT: lsr r0, r0, #31
; ARM78-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i64_signbit_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: push {r7, lr}
; THUMB6-NEXT: bl __lshrdi3
; THUMB6-NEXT: movs r0, #1
; THUMB6-NEXT: lsls r2, r0, #31
; THUMB6-NEXT: ands r2, r1
; THUMB6-NEXT: rsbs r0, r2, #0
; THUMB6-NEXT: adcs r0, r2
; THUMB6-NEXT: pop {r7, pc}
;
; THUMB78-LABEL: scalar_i64_signbit_eq:
; THUMB78: @ %bb.0:
; THUMB78-NEXT: lsr.w r0, r1, r2
; THUMB78-NEXT: subs.w r1, r2, #32
; THUMB78-NEXT: it pl
; THUMB78-NEXT: movpl r0, #0
; THUMB78-NEXT: mvns r0, r0
; THUMB78-NEXT: lsrs r0, r0, #31
; THUMB78-NEXT: bx lr
%t0 = shl i64 9223372036854775808, %y
%t1 = and i64 %t0, %x
%res = icmp eq i64 %t1, 0
ret i1 %res
}
define i1 @scalar_i64_lowestbit_eq(i64 %x, i64 %y) nounwind {
; ARM-LABEL: scalar_i64_lowestbit_eq:
; ARM: @ %bb.0:
; ARM-NEXT: rsb r3, r2, #32
; ARM-NEXT: lsr r0, r0, r2
; ARM-NEXT: subs r2, r2, #32
; ARM-NEXT: orr r0, r0, r1, lsl r3
; ARM-NEXT: lsrpl r0, r1, r2
; ARM-NEXT: mov r1, #1
; ARM-NEXT: bic r0, r1, r0
; ARM-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i64_lowestbit_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: push {r7, lr}
; THUMB6-NEXT: bl __lshrdi3
; THUMB6-NEXT: movs r1, #1
; THUMB6-NEXT: ands r1, r0
; THUMB6-NEXT: rsbs r0, r1, #0
; THUMB6-NEXT: adcs r0, r1
; THUMB6-NEXT: pop {r7, pc}
;
; THUMB7-LABEL: scalar_i64_lowestbit_eq:
; THUMB7: @ %bb.0:
; THUMB7-NEXT: rsb.w r3, r2, #32
; THUMB7-NEXT: lsrs r0, r2
; THUMB7-NEXT: subs r2, #32
; THUMB7-NEXT: lsl.w r3, r1, r3
; THUMB7-NEXT: orr.w r0, r0, r3
; THUMB7-NEXT: it pl
; THUMB7-NEXT: lsrpl.w r0, r1, r2
; THUMB7-NEXT: movs r1, #1
; THUMB7-NEXT: bic.w r0, r1, r0
; THUMB7-NEXT: bx lr
;
; THUMB8-LABEL: scalar_i64_lowestbit_eq:
; THUMB8: @ %bb.0:
; THUMB8-NEXT: rsb.w r3, r2, #32
; THUMB8-NEXT: lsrs r0, r2
; THUMB8-NEXT: lsl.w r3, r1, r3
; THUMB8-NEXT: orrs r0, r3
; THUMB8-NEXT: subs r2, #32
; THUMB8-NEXT: lsr.w r1, r1, r2
; THUMB8-NEXT: it mi
; THUMB8-NEXT: movmi r1, r0
; THUMB8-NEXT: movs r0, #1
; THUMB8-NEXT: bics r0, r1
; THUMB8-NEXT: bx lr
%t0 = shl i64 1, %y
%t1 = and i64 %t0, %x
%res = icmp eq i64 %t1, 0
ret i1 %res
}
define i1 @scalar_i64_bitsinmiddle_eq(i64 %x, i64 %y) nounwind {
; ARM6-LABEL: scalar_i64_bitsinmiddle_eq:
; ARM6: @ %bb.0:
; ARM6-NEXT: rsb r3, r2, #32
; ARM6-NEXT: lsr r0, r0, r2
; ARM6-NEXT: orr r0, r0, r1, lsl r3
; ARM6-NEXT: subs r3, r2, #32
; ARM6-NEXT: lsrpl r0, r1, r3
; ARM6-NEXT: lsr r1, r1, r2
; ARM6-NEXT: movpl r1, #0
; ARM6-NEXT: pkhbt r0, r1, r0
; ARM6-NEXT: clz r0, r0
; ARM6-NEXT: lsr r0, r0, #5
; ARM6-NEXT: bx lr
;
; ARM78-LABEL: scalar_i64_bitsinmiddle_eq:
; ARM78: @ %bb.0:
; ARM78-NEXT: rsb r3, r2, #32
; ARM78-NEXT: lsr r0, r0, r2
; ARM78-NEXT: orr r0, r0, r1, lsl r3
; ARM78-NEXT: subs r3, r2, #32
; ARM78-NEXT: lsrpl r0, r1, r3
; ARM78-NEXT: lsr r1, r1, r2
; ARM78-NEXT: movwpl r1, #0
; ARM78-NEXT: pkhbt r0, r1, r0
; ARM78-NEXT: clz r0, r0
; ARM78-NEXT: lsr r0, r0, #5
; ARM78-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i64_bitsinmiddle_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: push {r7, lr}
; THUMB6-NEXT: bl __lshrdi3
; THUMB6-NEXT: ldr r2, .LCPI11_0
; THUMB6-NEXT: ands r2, r0
; THUMB6-NEXT: uxth r0, r1
; THUMB6-NEXT: adds r1, r2, r0
; THUMB6-NEXT: rsbs r0, r1, #0
; THUMB6-NEXT: adcs r0, r1
; THUMB6-NEXT: pop {r7, pc}
; THUMB6-NEXT: .p2align 2
; THUMB6-NEXT: @ %bb.1:
; THUMB6-NEXT: .LCPI11_0:
; THUMB6-NEXT: .long 4294901760 @ 0xffff0000
;
; THUMB7-LABEL: scalar_i64_bitsinmiddle_eq:
; THUMB7: @ %bb.0:
; THUMB7-NEXT: rsb.w r3, r2, #32
; THUMB7-NEXT: lsrs r0, r2
; THUMB7-NEXT: lsl.w r3, r1, r3
; THUMB7-NEXT: orrs r0, r3
; THUMB7-NEXT: subs.w r3, r2, #32
; THUMB7-NEXT: it pl
; THUMB7-NEXT: lsrpl.w r0, r1, r3
; THUMB7-NEXT: lsr.w r1, r1, r2
; THUMB7-NEXT: it pl
; THUMB7-NEXT: movpl r1, #0
; THUMB7-NEXT: pkhbt r0, r1, r0
; THUMB7-NEXT: clz r0, r0
; THUMB7-NEXT: lsrs r0, r0, #5
; THUMB7-NEXT: bx lr
;
; THUMB8-LABEL: scalar_i64_bitsinmiddle_eq:
; THUMB8: @ %bb.0:
; THUMB8-NEXT: rsb.w r3, r2, #32
; THUMB8-NEXT: lsrs r0, r2
; THUMB8-NEXT: lsl.w r3, r1, r3
; THUMB8-NEXT: orrs r0, r3
; THUMB8-NEXT: subs.w r3, r2, #32
; THUMB8-NEXT: lsr.w r3, r1, r3
; THUMB8-NEXT: it mi
; THUMB8-NEXT: movmi r3, r0
; THUMB8-NEXT: lsr.w r0, r1, r2
; THUMB8-NEXT: it pl
; THUMB8-NEXT: movpl r0, #0
; THUMB8-NEXT: pkhbt r0, r0, r3
; THUMB8-NEXT: clz r0, r0
; THUMB8-NEXT: lsrs r0, r0, #5
; THUMB8-NEXT: bx lr
%t0 = shl i64 281474976645120, %y
%t1 = and i64 %t0, %x
%res = icmp eq i64 %t1, 0
ret i1 %res
}
;------------------------------------------------------------------------------;
; A few trivial vector tests
;------------------------------------------------------------------------------;
define <4 x i1> @vec_4xi32_splat_eq(<4 x i32> %x, <4 x i32> %y) nounwind {
; ARM6-LABEL: vec_4xi32_splat_eq:
; ARM6: @ %bb.0:
; ARM6-NEXT: push {r11, lr}
; ARM6-NEXT: ldr r12, [sp, #8]
; ARM6-NEXT: mov lr, #1
; ARM6-NEXT: bic r0, lr, r0, lsr r12
; ARM6-NEXT: ldr r12, [sp, #12]
; ARM6-NEXT: bic r1, lr, r1, lsr r12
; ARM6-NEXT: ldr r12, [sp, #16]
; ARM6-NEXT: bic r2, lr, r2, lsr r12
; ARM6-NEXT: ldr r12, [sp, #20]
; ARM6-NEXT: bic r3, lr, r3, lsr r12
; ARM6-NEXT: pop {r11, pc}
;
; ARM78-LABEL: vec_4xi32_splat_eq:
; ARM78: @ %bb.0:
; ARM78-NEXT: mov r12, sp
; ARM78-NEXT: vld1.64 {d16, d17}, [r12]
; ARM78-NEXT: vmov d19, r2, r3
; ARM78-NEXT: vneg.s32 q8, q8
; ARM78-NEXT: vmov d18, r0, r1
; ARM78-NEXT: vmov.i32 q10, #0x1
; ARM78-NEXT: vshl.u32 q8, q9, q8
; ARM78-NEXT: vtst.32 q8, q8, q10
; ARM78-NEXT: vmvn q8, q8
; ARM78-NEXT: vmovn.i32 d16, q8
; ARM78-NEXT: vmov r0, r1, d16
; ARM78-NEXT: bx lr
;
; THUMB6-LABEL: vec_4xi32_splat_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: push {r4, r5, r7, lr}
; THUMB6-NEXT: ldr r4, [sp, #16]
; THUMB6-NEXT: lsrs r0, r4
; THUMB6-NEXT: movs r4, #1
; THUMB6-NEXT: ands r0, r4
; THUMB6-NEXT: rsbs r5, r0, #0
; THUMB6-NEXT: adcs r0, r5
; THUMB6-NEXT: ldr r5, [sp, #20]
; THUMB6-NEXT: lsrs r1, r5
; THUMB6-NEXT: ands r1, r4
; THUMB6-NEXT: rsbs r5, r1, #0
; THUMB6-NEXT: adcs r1, r5
; THUMB6-NEXT: ldr r5, [sp, #24]
; THUMB6-NEXT: lsrs r2, r5
; THUMB6-NEXT: ands r2, r4
; THUMB6-NEXT: rsbs r5, r2, #0
; THUMB6-NEXT: adcs r2, r5
; THUMB6-NEXT: ldr r5, [sp, #28]
; THUMB6-NEXT: lsrs r3, r5
; THUMB6-NEXT: ands r3, r4
; THUMB6-NEXT: rsbs r4, r3, #0
; THUMB6-NEXT: adcs r3, r4
; THUMB6-NEXT: pop {r4, r5, r7, pc}
;
; THUMB78-LABEL: vec_4xi32_splat_eq:
; THUMB78: @ %bb.0:
; THUMB78-NEXT: mov r12, sp
; THUMB78-NEXT: vld1.64 {d16, d17}, [r12]
; THUMB78-NEXT: vmov d19, r2, r3
; THUMB78-NEXT: vneg.s32 q8, q8
; THUMB78-NEXT: vmov d18, r0, r1
; THUMB78-NEXT: vmov.i32 q10, #0x1
; THUMB78-NEXT: vshl.u32 q8, q9, q8
; THUMB78-NEXT: vtst.32 q8, q8, q10
; THUMB78-NEXT: vmvn q8, q8
; THUMB78-NEXT: vmovn.i32 d16, q8
; THUMB78-NEXT: vmov r0, r1, d16
; THUMB78-NEXT: bx lr
%t0 = shl <4 x i32> <i32 1, i32 1, i32 1, i32 1>, %y
%t1 = and <4 x i32> %t0, %x
%res = icmp eq <4 x i32> %t1, <i32 0, i32 0, i32 0, i32 0>
ret <4 x i1> %res
}
define <4 x i1> @vec_4xi32_nonsplat_eq(<4 x i32> %x, <4 x i32> %y) nounwind {
; ARM6-LABEL: vec_4xi32_nonsplat_eq:
; ARM6: @ %bb.0:
; ARM6-NEXT: ldr r12, [sp, #4]
; ARM6-NEXT: mov r0, #1
; ARM6-NEXT: bic r1, r0, r1, lsr r12
; ARM6-NEXT: ldr r12, [sp, #8]
; ARM6-NEXT: mov r0, #65280
; ARM6-NEXT: orr r0, r0, #16711680
; ARM6-NEXT: and r0, r0, r2, lsr r12
; ARM6-NEXT: clz r0, r0
; ARM6-NEXT: lsr r2, r0, #5
; ARM6-NEXT: ldr r0, [sp, #12]
; ARM6-NEXT: mvn r0, r3, lsr r0
; ARM6-NEXT: lsr r3, r0, #31
; ARM6-NEXT: mov r0, #1
; ARM6-NEXT: bx lr
;
; ARM78-LABEL: vec_4xi32_nonsplat_eq:
; ARM78: @ %bb.0:
; ARM78-NEXT: mov r12, sp
; ARM78-NEXT: vld1.64 {d16, d17}, [r12]
; ARM78-NEXT: adr r12, .LCPI13_0
; ARM78-NEXT: vld1.64 {d18, d19}, [r12:128]
; ARM78-NEXT: vshl.u32 q8, q9, q8
; ARM78-NEXT: vmov d19, r2, r3
; ARM78-NEXT: vmov d18, r0, r1
; ARM78-NEXT: vtst.32 q8, q8, q9
; ARM78-NEXT: vmvn q8, q8
; ARM78-NEXT: vmovn.i32 d16, q8
; ARM78-NEXT: vmov r0, r1, d16
; ARM78-NEXT: bx lr
; ARM78-NEXT: .p2align 4
; ARM78-NEXT: @ %bb.1:
; ARM78-NEXT: .LCPI13_0:
; ARM78-NEXT: .long 0 @ 0x0
; ARM78-NEXT: .long 1 @ 0x1
; ARM78-NEXT: .long 16776960 @ 0xffff00
; ARM78-NEXT: .long 2147483648 @ 0x80000000
;
; THUMB6-LABEL: vec_4xi32_nonsplat_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: push {r4, lr}
; THUMB6-NEXT: ldr r0, [sp, #12]
; THUMB6-NEXT: lsrs r1, r0
; THUMB6-NEXT: movs r0, #1
; THUMB6-NEXT: ands r1, r0
; THUMB6-NEXT: rsbs r4, r1, #0
; THUMB6-NEXT: adcs r1, r4
; THUMB6-NEXT: ldr r4, [sp, #16]
; THUMB6-NEXT: lsrs r2, r4
; THUMB6-NEXT: ldr r4, .LCPI13_0
; THUMB6-NEXT: ands r4, r2
; THUMB6-NEXT: rsbs r2, r4, #0
; THUMB6-NEXT: adcs r2, r4
; THUMB6-NEXT: ldr r4, [sp, #20]
; THUMB6-NEXT: lsrs r3, r4
; THUMB6-NEXT: lsls r4, r0, #31
; THUMB6-NEXT: ands r4, r3
; THUMB6-NEXT: rsbs r3, r4, #0
; THUMB6-NEXT: adcs r3, r4
; THUMB6-NEXT: pop {r4, pc}
; THUMB6-NEXT: .p2align 2
; THUMB6-NEXT: @ %bb.1:
; THUMB6-NEXT: .LCPI13_0:
; THUMB6-NEXT: .long 16776960 @ 0xffff00
;
; THUMB78-LABEL: vec_4xi32_nonsplat_eq:
; THUMB78: @ %bb.0:
; THUMB78-NEXT: mov r12, sp
; THUMB78-NEXT: vld1.64 {d16, d17}, [r12]
; THUMB78-NEXT: adr.w r12, .LCPI13_0
; THUMB78-NEXT: vld1.64 {d18, d19}, [r12:128]
; THUMB78-NEXT: vshl.u32 q8, q9, q8
; THUMB78-NEXT: vmov d19, r2, r3
; THUMB78-NEXT: vmov d18, r0, r1
; THUMB78-NEXT: vtst.32 q8, q8, q9
; THUMB78-NEXT: vmvn q8, q8
; THUMB78-NEXT: vmovn.i32 d16, q8
; THUMB78-NEXT: vmov r0, r1, d16
; THUMB78-NEXT: bx lr
; THUMB78-NEXT: .p2align 4
; THUMB78-NEXT: @ %bb.1:
; THUMB78-NEXT: .LCPI13_0:
; THUMB78-NEXT: .long 0 @ 0x0
; THUMB78-NEXT: .long 1 @ 0x1
; THUMB78-NEXT: .long 16776960 @ 0xffff00
; THUMB78-NEXT: .long 2147483648 @ 0x80000000
%t0 = shl <4 x i32> <i32 0, i32 1, i32 16776960, i32 2147483648>, %y
%t1 = and <4 x i32> %t0, %x
%res = icmp eq <4 x i32> %t1, <i32 0, i32 0, i32 0, i32 0>
ret <4 x i1> %res
}
define <4 x i1> @vec_4xi32_nonsplat_undef0_eq(<4 x i32> %x, <4 x i32> %y) nounwind {
; ARM6-LABEL: vec_4xi32_nonsplat_undef0_eq:
; ARM6: @ %bb.0:
; ARM6-NEXT: push {r11, lr}
; ARM6-NEXT: ldr r2, [sp, #12]
; ARM6-NEXT: mov lr, #1
; ARM6-NEXT: ldr r12, [sp, #8]
; ARM6-NEXT: bic r1, lr, r1, lsr r2
; ARM6-NEXT: ldr r2, [sp, #20]
; ARM6-NEXT: bic r0, lr, r0, lsr r12
; ARM6-NEXT: bic r3, lr, r3, lsr r2
; ARM6-NEXT: mov r2, #1
; ARM6-NEXT: pop {r11, pc}
;
; ARM78-LABEL: vec_4xi32_nonsplat_undef0_eq:
; ARM78: @ %bb.0:
; ARM78-NEXT: mov r12, sp
; ARM78-NEXT: vld1.64 {d16, d17}, [r12]
; ARM78-NEXT: vmov d19, r2, r3
; ARM78-NEXT: vneg.s32 q8, q8
; ARM78-NEXT: vmov d18, r0, r1
; ARM78-NEXT: vmov.i32 q10, #0x1
; ARM78-NEXT: vshl.u32 q8, q9, q8
; ARM78-NEXT: vtst.32 q8, q8, q10
; ARM78-NEXT: vmvn q8, q8
; ARM78-NEXT: vmovn.i32 d16, q8
; ARM78-NEXT: vmov r0, r1, d16
; ARM78-NEXT: bx lr
;
; THUMB6-LABEL: vec_4xi32_nonsplat_undef0_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: push {r4, lr}
; THUMB6-NEXT: ldr r2, [sp, #8]
; THUMB6-NEXT: lsrs r0, r2
; THUMB6-NEXT: movs r2, #1
; THUMB6-NEXT: ands r0, r2
; THUMB6-NEXT: rsbs r4, r0, #0
; THUMB6-NEXT: adcs r0, r4
; THUMB6-NEXT: ldr r4, [sp, #12]
; THUMB6-NEXT: lsrs r1, r4
; THUMB6-NEXT: ands r1, r2
; THUMB6-NEXT: rsbs r4, r1, #0
; THUMB6-NEXT: adcs r1, r4
; THUMB6-NEXT: ldr r4, [sp, #20]
; THUMB6-NEXT: lsrs r3, r4
; THUMB6-NEXT: ands r3, r2
; THUMB6-NEXT: rsbs r4, r3, #0
; THUMB6-NEXT: adcs r3, r4
; THUMB6-NEXT: pop {r4, pc}
;
; THUMB78-LABEL: vec_4xi32_nonsplat_undef0_eq:
; THUMB78: @ %bb.0:
; THUMB78-NEXT: mov r12, sp
; THUMB78-NEXT: vld1.64 {d16, d17}, [r12]
; THUMB78-NEXT: vmov d19, r2, r3
; THUMB78-NEXT: vneg.s32 q8, q8
; THUMB78-NEXT: vmov d18, r0, r1
; THUMB78-NEXT: vmov.i32 q10, #0x1
; THUMB78-NEXT: vshl.u32 q8, q9, q8
; THUMB78-NEXT: vtst.32 q8, q8, q10
; THUMB78-NEXT: vmvn q8, q8
; THUMB78-NEXT: vmovn.i32 d16, q8
; THUMB78-NEXT: vmov r0, r1, d16
; THUMB78-NEXT: bx lr
%t0 = shl <4 x i32> <i32 1, i32 1, i32 undef, i32 1>, %y
%t1 = and <4 x i32> %t0, %x
%res = icmp eq <4 x i32> %t1, <i32 0, i32 0, i32 0, i32 0>
ret <4 x i1> %res
}
define <4 x i1> @vec_4xi32_nonsplat_undef1_eq(<4 x i32> %x, <4 x i32> %y) nounwind {
; ARM6-LABEL: vec_4xi32_nonsplat_undef1_eq:
; ARM6: @ %bb.0:
; ARM6-NEXT: push {r11, lr}
; ARM6-NEXT: ldr r2, [sp, #12]
; ARM6-NEXT: mov lr, #1
; ARM6-NEXT: ldr r12, [sp, #8]
; ARM6-NEXT: bic r1, lr, r1, lsr r2
; ARM6-NEXT: ldr r2, [sp, #20]
; ARM6-NEXT: bic r0, lr, r0, lsr r12
; ARM6-NEXT: bic r3, lr, r3, lsr r2
; ARM6-NEXT: pop {r11, pc}
;
; ARM78-LABEL: vec_4xi32_nonsplat_undef1_eq:
; ARM78: @ %bb.0:
; ARM78-NEXT: vmov.i32 q8, #0x1
; ARM78-NEXT: mov r12, sp
; ARM78-NEXT: vld1.64 {d18, d19}, [r12]
; ARM78-NEXT: vshl.u32 q8, q8, q9
; ARM78-NEXT: vmov d19, r2, r3
; ARM78-NEXT: vmov d18, r0, r1
; ARM78-NEXT: vtst.32 q8, q8, q9
; ARM78-NEXT: vmvn q8, q8
; ARM78-NEXT: vmovn.i32 d16, q8
; ARM78-NEXT: vmov r0, r1, d16
; ARM78-NEXT: bx lr
;
; THUMB6-LABEL: vec_4xi32_nonsplat_undef1_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: push {r4, lr}
; THUMB6-NEXT: ldr r2, [sp, #8]
; THUMB6-NEXT: lsrs r0, r2
; THUMB6-NEXT: movs r2, #1
; THUMB6-NEXT: ands r0, r2
; THUMB6-NEXT: rsbs r4, r0, #0
; THUMB6-NEXT: adcs r0, r4
; THUMB6-NEXT: ldr r4, [sp, #12]
; THUMB6-NEXT: lsrs r1, r4
; THUMB6-NEXT: ands r1, r2
; THUMB6-NEXT: rsbs r4, r1, #0
; THUMB6-NEXT: adcs r1, r4
; THUMB6-NEXT: ldr r4, [sp, #20]
; THUMB6-NEXT: lsrs r3, r4
; THUMB6-NEXT: ands r3, r2
; THUMB6-NEXT: rsbs r2, r3, #0
; THUMB6-NEXT: adcs r3, r2
; THUMB6-NEXT: pop {r4, pc}
;
; THUMB78-LABEL: vec_4xi32_nonsplat_undef1_eq:
; THUMB78: @ %bb.0:
; THUMB78-NEXT: vmov.i32 q8, #0x1
; THUMB78-NEXT: mov r12, sp
; THUMB78-NEXT: vld1.64 {d18, d19}, [r12]
; THUMB78-NEXT: vshl.u32 q8, q8, q9
; THUMB78-NEXT: vmov d19, r2, r3
; THUMB78-NEXT: vmov d18, r0, r1
; THUMB78-NEXT: vtst.32 q8, q8, q9
; THUMB78-NEXT: vmvn q8, q8
; THUMB78-NEXT: vmovn.i32 d16, q8
; THUMB78-NEXT: vmov r0, r1, d16
; THUMB78-NEXT: bx lr
%t0 = shl <4 x i32> <i32 1, i32 1, i32 1, i32 1>, %y
%t1 = and <4 x i32> %t0, %x
%res = icmp eq <4 x i32> %t1, <i32 0, i32 0, i32 undef, i32 0>
ret <4 x i1> %res
}
define <4 x i1> @vec_4xi32_nonsplat_undef2_eq(<4 x i32> %x, <4 x i32> %y) nounwind {
; ARM6-LABEL: vec_4xi32_nonsplat_undef2_eq:
; ARM6: @ %bb.0:
; ARM6-NEXT: push {r11, lr}
; ARM6-NEXT: ldr r2, [sp, #12]
; ARM6-NEXT: mov lr, #1
; ARM6-NEXT: ldr r12, [sp, #8]
; ARM6-NEXT: bic r1, lr, r1, lsr r2
; ARM6-NEXT: ldr r2, [sp, #20]
; ARM6-NEXT: bic r0, lr, r0, lsr r12
; ARM6-NEXT: bic r3, lr, r3, lsr r2
; ARM6-NEXT: pop {r11, pc}
;
; ARM78-LABEL: vec_4xi32_nonsplat_undef2_eq:
; ARM78: @ %bb.0:
; ARM78-NEXT: vmov.i32 q8, #0x1
; ARM78-NEXT: mov r12, sp
; ARM78-NEXT: vld1.64 {d18, d19}, [r12]
; ARM78-NEXT: vshl.u32 q8, q8, q9
; ARM78-NEXT: vmov d19, r2, r3
; ARM78-NEXT: vmov d18, r0, r1
; ARM78-NEXT: vtst.32 q8, q8, q9
; ARM78-NEXT: vmvn q8, q8
; ARM78-NEXT: vmovn.i32 d16, q8
; ARM78-NEXT: vmov r0, r1, d16
; ARM78-NEXT: bx lr
;
; THUMB6-LABEL: vec_4xi32_nonsplat_undef2_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: push {r4, lr}
; THUMB6-NEXT: ldr r2, [sp, #8]
; THUMB6-NEXT: lsrs r0, r2
; THUMB6-NEXT: movs r2, #1
; THUMB6-NEXT: ands r0, r2
; THUMB6-NEXT: rsbs r4, r0, #0
; THUMB6-NEXT: adcs r0, r4
; THUMB6-NEXT: ldr r4, [sp, #12]
; THUMB6-NEXT: lsrs r1, r4
; THUMB6-NEXT: ands r1, r2
; THUMB6-NEXT: rsbs r4, r1, #0
; THUMB6-NEXT: adcs r1, r4
; THUMB6-NEXT: ldr r4, [sp, #20]
; THUMB6-NEXT: lsrs r3, r4
; THUMB6-NEXT: ands r3, r2
; THUMB6-NEXT: rsbs r2, r3, #0
; THUMB6-NEXT: adcs r3, r2
; THUMB6-NEXT: pop {r4, pc}
;
; THUMB78-LABEL: vec_4xi32_nonsplat_undef2_eq:
; THUMB78: @ %bb.0:
; THUMB78-NEXT: vmov.i32 q8, #0x1
; THUMB78-NEXT: mov r12, sp
; THUMB78-NEXT: vld1.64 {d18, d19}, [r12]
; THUMB78-NEXT: vshl.u32 q8, q8, q9
; THUMB78-NEXT: vmov d19, r2, r3
; THUMB78-NEXT: vmov d18, r0, r1
; THUMB78-NEXT: vtst.32 q8, q8, q9
; THUMB78-NEXT: vmvn q8, q8
; THUMB78-NEXT: vmovn.i32 d16, q8
; THUMB78-NEXT: vmov r0, r1, d16
; THUMB78-NEXT: bx lr
%t0 = shl <4 x i32> <i32 1, i32 1, i32 undef, i32 1>, %y
%t1 = and <4 x i32> %t0, %x
%res = icmp eq <4 x i32> %t1, <i32 0, i32 0, i32 undef, i32 0>
ret <4 x i1> %res
}
;------------------------------------------------------------------------------;
; A special tests
;------------------------------------------------------------------------------;
define i1 @scalar_i8_signbit_ne(i8 %x, i8 %y) nounwind {
; ARM-LABEL: scalar_i8_signbit_ne:
; ARM: @ %bb.0:
; ARM-NEXT: uxtb r1, r1
; ARM-NEXT: uxtb r0, r0
; ARM-NEXT: lsr r0, r0, r1
; ARM-NEXT: lsr r0, r0, #7
; ARM-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i8_signbit_ne:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: uxtb r1, r1
; THUMB6-NEXT: uxtb r0, r0
; THUMB6-NEXT: lsrs r0, r1
; THUMB6-NEXT: lsrs r0, r0, #7
; THUMB6-NEXT: bx lr
;
; THUMB7-LABEL: scalar_i8_signbit_ne:
; THUMB7: @ %bb.0:
; THUMB7-NEXT: uxtb r1, r1
; THUMB7-NEXT: uxtb r0, r0
; THUMB7-NEXT: lsrs r0, r1
; THUMB7-NEXT: lsrs r0, r0, #7
; THUMB7-NEXT: bx lr
;
; THUMB8-LABEL: scalar_i8_signbit_ne:
; THUMB8: @ %bb.0:
; THUMB8-NEXT: uxtb r0, r0
; THUMB8-NEXT: uxtb r1, r1
; THUMB8-NEXT: lsrs r0, r1
; THUMB8-NEXT: lsrs r0, r0, #7
; THUMB8-NEXT: bx lr
%t0 = shl i8 128, %y
%t1 = and i8 %t0, %x
%res = icmp ne i8 %t1, 0 ; we are perfectly happy with 'ne' predicate
ret i1 %res
}
;------------------------------------------------------------------------------;
; What if X is a constant too?
;------------------------------------------------------------------------------;
define i1 @scalar_i32_x_is_const_eq(i32 %y) nounwind {
; ARM6-LABEL: scalar_i32_x_is_const_eq:
; ARM6: @ %bb.0:
; ARM6-NEXT: ldr r1, .LCPI18_0
; ARM6-NEXT: mov r2, #1
; ARM6-NEXT: bic r0, r2, r1, lsl r0
; ARM6-NEXT: bx lr
; ARM6-NEXT: .p2align 2
; ARM6-NEXT: @ %bb.1:
; ARM6-NEXT: .LCPI18_0:
; ARM6-NEXT: .long 2857740885 @ 0xaa55aa55
;
; ARM78-LABEL: scalar_i32_x_is_const_eq:
; ARM78: @ %bb.0:
; ARM78-NEXT: movw r1, #43605
; ARM78-NEXT: mov r2, #1
; ARM78-NEXT: movt r1, #43605
; ARM78-NEXT: bic r0, r2, r1, lsl r0
; ARM78-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i32_x_is_const_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: ldr r1, .LCPI18_0
; THUMB6-NEXT: lsls r1, r0
; THUMB6-NEXT: movs r2, #1
; THUMB6-NEXT: ands r2, r1
; THUMB6-NEXT: rsbs r0, r2, #0
; THUMB6-NEXT: adcs r0, r2
; THUMB6-NEXT: bx lr
; THUMB6-NEXT: .p2align 2
; THUMB6-NEXT: @ %bb.1:
; THUMB6-NEXT: .LCPI18_0:
; THUMB6-NEXT: .long 2857740885 @ 0xaa55aa55
;
; THUMB78-LABEL: scalar_i32_x_is_const_eq:
; THUMB78: @ %bb.0:
; THUMB78-NEXT: movw r1, #43605
; THUMB78-NEXT: movt r1, #43605
; THUMB78-NEXT: lsl.w r0, r1, r0
; THUMB78-NEXT: movs r1, #1
; THUMB78-NEXT: bic.w r0, r1, r0
; THUMB78-NEXT: bx lr
%t0 = shl i32 2857740885, %y
%t1 = and i32 %t0, 1
%res = icmp eq i32 %t1, 0
ret i1 %res
}
define i1 @scalar_i32_x_is_const2_eq(i32 %y) nounwind {
; ARM6-LABEL: scalar_i32_x_is_const2_eq:
; ARM6: @ %bb.0:
; ARM6-NEXT: ldr r2, .LCPI19_0
; ARM6-NEXT: mov r1, #1
; ARM6-NEXT: and r0, r2, r1, lsl r0
; ARM6-NEXT: clz r0, r0
; ARM6-NEXT: lsr r0, r0, #5
; ARM6-NEXT: bx lr
; ARM6-NEXT: .p2align 2
; ARM6-NEXT: @ %bb.1:
; ARM6-NEXT: .LCPI19_0:
; ARM6-NEXT: .long 2857740885 @ 0xaa55aa55
;
; ARM78-LABEL: scalar_i32_x_is_const2_eq:
; ARM78: @ %bb.0:
; ARM78-NEXT: movw r1, #43605
; ARM78-NEXT: mov r2, #1
; ARM78-NEXT: movt r1, #43605
; ARM78-NEXT: and r0, r1, r2, lsl r0
; ARM78-NEXT: clz r0, r0
; ARM78-NEXT: lsr r0, r0, #5
; ARM78-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i32_x_is_const2_eq:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: movs r1, #1
; THUMB6-NEXT: lsls r1, r0
; THUMB6-NEXT: ldr r2, .LCPI19_0
; THUMB6-NEXT: ands r2, r1
; THUMB6-NEXT: rsbs r0, r2, #0
; THUMB6-NEXT: adcs r0, r2
; THUMB6-NEXT: bx lr
; THUMB6-NEXT: .p2align 2
; THUMB6-NEXT: @ %bb.1:
; THUMB6-NEXT: .LCPI19_0:
; THUMB6-NEXT: .long 2857740885 @ 0xaa55aa55
;
; THUMB78-LABEL: scalar_i32_x_is_const2_eq:
; THUMB78: @ %bb.0:
; THUMB78-NEXT: movs r1, #1
; THUMB78-NEXT: lsl.w r0, r1, r0
; THUMB78-NEXT: movw r1, #43605
; THUMB78-NEXT: movt r1, #43605
; THUMB78-NEXT: ands r0, r1
; THUMB78-NEXT: clz r0, r0
; THUMB78-NEXT: lsrs r0, r0, #5
; THUMB78-NEXT: bx lr
%t0 = shl i32 1, %y
%t1 = and i32 %t0, 2857740885
%res = icmp eq i32 %t1, 0
ret i1 %res
}
;------------------------------------------------------------------------------;
; A few negative tests
;------------------------------------------------------------------------------;
define i1 @negative_scalar_i8_bitsinmiddle_slt(i8 %x, i8 %y) nounwind {
; ARM6-LABEL: negative_scalar_i8_bitsinmiddle_slt:
; ARM6: @ %bb.0:
; ARM6-NEXT: uxtb r1, r1
; ARM6-NEXT: mov r2, #24
; ARM6-NEXT: and r0, r0, r2, lsl r1
; ARM6-NEXT: sxtb r1, r0
; ARM6-NEXT: mov r0, #0
; ARM6-NEXT: cmp r1, #0
; ARM6-NEXT: movmi r0, #1
; ARM6-NEXT: bx lr
;
; ARM78-LABEL: negative_scalar_i8_bitsinmiddle_slt:
; ARM78: @ %bb.0:
; ARM78-NEXT: uxtb r1, r1
; ARM78-NEXT: mov r2, #24
; ARM78-NEXT: and r0, r0, r2, lsl r1
; ARM78-NEXT: sxtb r1, r0
; ARM78-NEXT: mov r0, #0
; ARM78-NEXT: cmp r1, #0
; ARM78-NEXT: movwmi r0, #1
; ARM78-NEXT: bx lr
;
; THUMB6-LABEL: negative_scalar_i8_bitsinmiddle_slt:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: uxtb r1, r1
; THUMB6-NEXT: movs r2, #24
; THUMB6-NEXT: lsls r2, r1
; THUMB6-NEXT: ands r2, r0
; THUMB6-NEXT: sxtb r0, r2
; THUMB6-NEXT: cmp r0, #0
; THUMB6-NEXT: bmi .LBB20_2
; THUMB6-NEXT: @ %bb.1:
; THUMB6-NEXT: movs r0, #0
; THUMB6-NEXT: bx lr
; THUMB6-NEXT: .LBB20_2:
; THUMB6-NEXT: movs r0, #1
; THUMB6-NEXT: bx lr
;
; THUMB78-LABEL: negative_scalar_i8_bitsinmiddle_slt:
; THUMB78: @ %bb.0:
; THUMB78-NEXT: uxtb r1, r1
; THUMB78-NEXT: movs r2, #24
; THUMB78-NEXT: lsl.w r1, r2, r1
; THUMB78-NEXT: ands r0, r1
; THUMB78-NEXT: sxtb r1, r0
; THUMB78-NEXT: movs r0, #0
; THUMB78-NEXT: cmp r1, #0
; THUMB78-NEXT: it mi
; THUMB78-NEXT: movmi r0, #1
; THUMB78-NEXT: bx lr
%t0 = shl i8 24, %y
%t1 = and i8 %t0, %x
%res = icmp slt i8 %t1, 0
ret i1 %res
}
define i1 @scalar_i8_signbit_eq_with_nonzero(i8 %x, i8 %y) nounwind {
; ARM-LABEL: scalar_i8_signbit_eq_with_nonzero:
; ARM: @ %bb.0:
; ARM-NEXT: mov r0, #0
; ARM-NEXT: bx lr
;
; THUMB6-LABEL: scalar_i8_signbit_eq_with_nonzero:
; THUMB6: @ %bb.0:
; THUMB6-NEXT: uxtb r1, r1
; THUMB6-NEXT: movs r2, #127
; THUMB6-NEXT: mvns r2, r2
; THUMB6-NEXT: lsls r2, r1
; THUMB6-NEXT: ands r2, r0
; THUMB6-NEXT: uxtb r0, r2
; THUMB6-NEXT: subs r1, r0, #1
; THUMB6-NEXT: rsbs r0, r1, #0
; THUMB6-NEXT: adcs r0, r1
; THUMB6-NEXT: bx lr
;
; THUMB78-LABEL: scalar_i8_signbit_eq_with_nonzero:
; THUMB78: @ %bb.0:
; THUMB78-NEXT: movs r0, #0
; THUMB78-NEXT: bx lr
%t0 = shl i8 128, %y
%t1 = and i8 %t0, %x
%res = icmp eq i8 %t1, 1 ; should be comparing with 0
ret i1 %res
}