Skip to content

Commit cef0067

Browse files
committed
[DAG]: Updated tests
1 parent cf6ee58 commit cef0067

File tree

1 file changed

+116
-68
lines changed

1 file changed

+116
-68
lines changed

llvm/test/CodeGen/X86/andnot-patterns.ll

Lines changed: 116 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ define i64 @andnot_bitreverse_i64(i64 %a0, i64 %a1) nounwind {
761761
;
762762
; X86-BMI-LABEL: andnot_bitreverse_i64:
763763
; X86-BMI: # %bb.0:
764+
; X86-BMI-NEXT: pushl %esi
764765
; X86-BMI-NEXT: movl {{[0-9]+}}(%esp), %ecx
765766
; X86-BMI-NEXT: movl {{[0-9]+}}(%esp), %eax
766767
; X86-BMI-NEXT: bswapl %eax
@@ -774,13 +775,16 @@ define i64 @andnot_bitreverse_i64(i64 %a0, i64 %a1) nounwind {
774775
; X86-BMI-NEXT: andl $858993459, %edx # imm = 0x33333333
775776
; X86-BMI-NEXT: shrl $2, %eax
776777
; X86-BMI-NEXT: andl $858993459, %eax # imm = 0x33333333
777-
; X86-BMI-NEXT: leal (%eax,%edx,4), %eax
778-
; X86-BMI-NEXT: movl %eax, %edx
779-
; X86-BMI-NEXT: andl $1431655765, %edx # imm = 0x55555555
778+
; X86-BMI-NEXT: leal (%eax,%edx,4), %esi
779+
; X86-BMI-NEXT: andl $1431655765, %esi # imm = 0x55555555
780+
; X86-BMI-NEXT: addl %esi, %esi
781+
; X86-BMI-NEXT: shll $2, %edx
782+
; X86-BMI-NEXT: notl %edx
783+
; X86-BMI-NEXT: andnl %edx, %eax, %eax
780784
; X86-BMI-NEXT: shrl %eax
781-
; X86-BMI-NEXT: andl $1431655765, %eax # imm = 0x55555555
782-
; X86-BMI-NEXT: leal (%eax,%edx,2), %eax
783-
; X86-BMI-NEXT: andnl {{[0-9]+}}(%esp), %eax, %eax
785+
; X86-BMI-NEXT: orl $-1431655766, %eax # imm = 0xAAAAAAAA
786+
; X86-BMI-NEXT: andnl %eax, %esi, %eax
787+
; X86-BMI-NEXT: andl {{[0-9]+}}(%esp), %eax
784788
; X86-BMI-NEXT: bswapl %ecx
785789
; X86-BMI-NEXT: movl %ecx, %edx
786790
; X86-BMI-NEXT: andl $252645135, %edx # imm = 0xF0F0F0F
@@ -792,13 +796,17 @@ define i64 @andnot_bitreverse_i64(i64 %a0, i64 %a1) nounwind {
792796
; X86-BMI-NEXT: andl $858993459, %edx # imm = 0x33333333
793797
; X86-BMI-NEXT: shrl $2, %ecx
794798
; X86-BMI-NEXT: andl $858993459, %ecx # imm = 0x33333333
795-
; X86-BMI-NEXT: leal (%ecx,%edx,4), %ecx
796-
; X86-BMI-NEXT: movl %ecx, %edx
797-
; X86-BMI-NEXT: andl $1431655765, %edx # imm = 0x55555555
799+
; X86-BMI-NEXT: leal (%ecx,%edx,4), %esi
800+
; X86-BMI-NEXT: andl $1431655765, %esi # imm = 0x55555555
801+
; X86-BMI-NEXT: addl %esi, %esi
802+
; X86-BMI-NEXT: shll $2, %edx
803+
; X86-BMI-NEXT: notl %edx
804+
; X86-BMI-NEXT: andnl %edx, %ecx, %ecx
798805
; X86-BMI-NEXT: shrl %ecx
799-
; X86-BMI-NEXT: andl $1431655765, %ecx # imm = 0x55555555
800-
; X86-BMI-NEXT: leal (%ecx,%edx,2), %ecx
801-
; X86-BMI-NEXT: andnl {{[0-9]+}}(%esp), %ecx, %edx
806+
; X86-BMI-NEXT: orl $-1431655766, %ecx # imm = 0xAAAAAAAA
807+
; X86-BMI-NEXT: andnl %ecx, %esi, %edx
808+
; X86-BMI-NEXT: andl {{[0-9]+}}(%esp), %edx
809+
; X86-BMI-NEXT: popl %esi
802810
; X86-BMI-NEXT: retl
803811
;
804812
; X64-NOBMI-LABEL: andnot_bitreverse_i64:
@@ -837,19 +845,23 @@ define i64 @andnot_bitreverse_i64(i64 %a0, i64 %a1) nounwind {
837845
; X64-BMI-NEXT: andq %rcx, %rsi
838846
; X64-BMI-NEXT: shlq $4, %rsi
839847
; X64-BMI-NEXT: orq %rax, %rsi
840-
; X64-BMI-NEXT: movabsq $3689348814741910323, %rax # imm = 0x3333333333333333
841-
; X64-BMI-NEXT: movq %rsi, %rcx
842-
; X64-BMI-NEXT: andq %rax, %rcx
843-
; X64-BMI-NEXT: shrq $2, %rsi
844-
; X64-BMI-NEXT: andq %rax, %rsi
845-
; X64-BMI-NEXT: leaq (%rsi,%rcx,4), %rax
846-
; X64-BMI-NEXT: movabsq $6148914691236517205, %rcx # imm = 0x5555555555555555
847-
; X64-BMI-NEXT: movq %rax, %rdx
848-
; X64-BMI-NEXT: andq %rcx, %rdx
849-
; X64-BMI-NEXT: shrq %rax
848+
; X64-BMI-NEXT: movq %rsi, %rax
849+
; X64-BMI-NEXT: shrq $2, %rax
850+
; X64-BMI-NEXT: movabsq $3689348814741910323, %rcx # imm = 0x3333333333333333
850851
; X64-BMI-NEXT: andq %rcx, %rax
851-
; X64-BMI-NEXT: leaq (%rax,%rdx,2), %rax
852-
; X64-BMI-NEXT: andnq %rdi, %rax, %rax
852+
; X64-BMI-NEXT: andq %rcx, %rsi
853+
; X64-BMI-NEXT: leaq (,%rsi,4), %rcx
854+
; X64-BMI-NEXT: notq %rcx
855+
; X64-BMI-NEXT: andnq %rcx, %rax, %rcx
856+
; X64-BMI-NEXT: shrq %rcx
857+
; X64-BMI-NEXT: movabsq $-6148914691236517206, %rdx # imm = 0xAAAAAAAAAAAAAAAA
858+
; X64-BMI-NEXT: orq %rcx, %rdx
859+
; X64-BMI-NEXT: leaq (%rax,%rsi,4), %rax
860+
; X64-BMI-NEXT: movabsq $6148914691236517205, %rcx # imm = 0x5555555555555555
861+
; X64-BMI-NEXT: andq %rax, %rcx
862+
; X64-BMI-NEXT: addq %rcx, %rcx
863+
; X64-BMI-NEXT: andnq %rdx, %rcx, %rax
864+
; X64-BMI-NEXT: andq %rdi, %rax
853865
; X64-BMI-NEXT: retq
854866
%not = xor i64 %a1, -1
855867
%bitrev = tail call i64 @llvm.bitreverse.i64(i64 %not)
@@ -896,13 +908,16 @@ define i32 @andnot_bitreverse_i32(i32 %a0, i32 %a1) nounwind {
896908
; X86-BMI-NEXT: andl $858993459, %ecx # imm = 0x33333333
897909
; X86-BMI-NEXT: shrl $2, %eax
898910
; X86-BMI-NEXT: andl $858993459, %eax # imm = 0x33333333
899-
; X86-BMI-NEXT: leal (%eax,%ecx,4), %eax
900-
; X86-BMI-NEXT: movl %eax, %ecx
901-
; X86-BMI-NEXT: andl $1431655765, %ecx # imm = 0x55555555
911+
; X86-BMI-NEXT: leal (%eax,%ecx,4), %edx
912+
; X86-BMI-NEXT: andl $1431655765, %edx # imm = 0x55555555
913+
; X86-BMI-NEXT: addl %edx, %edx
914+
; X86-BMI-NEXT: shll $2, %ecx
915+
; X86-BMI-NEXT: notl %ecx
916+
; X86-BMI-NEXT: andnl %ecx, %eax, %eax
902917
; X86-BMI-NEXT: shrl %eax
903-
; X86-BMI-NEXT: andl $1431655765, %eax # imm = 0x55555555
904-
; X86-BMI-NEXT: leal (%eax,%ecx,2), %eax
905-
; X86-BMI-NEXT: andnl {{[0-9]+}}(%esp), %eax, %eax
918+
; X86-BMI-NEXT: orl $-1431655766, %eax # imm = 0xAAAAAAAA
919+
; X86-BMI-NEXT: andnl %eax, %edx, %eax
920+
; X86-BMI-NEXT: andl {{[0-9]+}}(%esp), %eax
906921
; X86-BMI-NEXT: retl
907922
;
908923
; X64-NOBMI-LABEL: andnot_bitreverse_i32:
@@ -940,16 +955,19 @@ define i32 @andnot_bitreverse_i32(i32 %a0, i32 %a1) nounwind {
940955
; X64-BMI-NEXT: andl $252645135, %esi # imm = 0xF0F0F0F
941956
; X64-BMI-NEXT: orl %eax, %esi
942957
; X64-BMI-NEXT: movl %esi, %eax
958+
; X64-BMI-NEXT: shrl $2, %eax
943959
; X64-BMI-NEXT: andl $858993459, %eax # imm = 0x33333333
944-
; X64-BMI-NEXT: shrl $2, %esi
945960
; X64-BMI-NEXT: andl $858993459, %esi # imm = 0x33333333
946-
; X64-BMI-NEXT: leal (%rsi,%rax,4), %eax
947-
; X64-BMI-NEXT: movl %eax, %ecx
948-
; X64-BMI-NEXT: andl $1431655765, %ecx # imm = 0x55555555
949-
; X64-BMI-NEXT: shrl %eax
961+
; X64-BMI-NEXT: leal (,%rsi,4), %ecx
962+
; X64-BMI-NEXT: notl %ecx
963+
; X64-BMI-NEXT: andnl %ecx, %eax, %ecx
964+
; X64-BMI-NEXT: shrl %ecx
965+
; X64-BMI-NEXT: orl $-1431655766, %ecx # imm = 0xAAAAAAAA
966+
; X64-BMI-NEXT: leal (%rax,%rsi,4), %eax
950967
; X64-BMI-NEXT: andl $1431655765, %eax # imm = 0x55555555
951-
; X64-BMI-NEXT: leal (%rax,%rcx,2), %eax
952-
; X64-BMI-NEXT: andnl %edi, %eax, %eax
968+
; X64-BMI-NEXT: addl %eax, %eax
969+
; X64-BMI-NEXT: andnl %ecx, %eax, %eax
970+
; X64-BMI-NEXT: andl %edi, %eax
953971
; X64-BMI-NEXT: retq
954972
%not = xor i32 %a1, -1
955973
%bitrev = tail call i32 @llvm.bitreverse.i32(i32 %not)
@@ -958,30 +976,57 @@ define i32 @andnot_bitreverse_i32(i32 %a0, i32 %a1) nounwind {
958976
}
959977

960978
define i16 @andnot_bitreverse_i16(i16 %a0, i16 %a1) nounwind {
961-
; X86-LABEL: andnot_bitreverse_i16:
962-
; X86: # %bb.0:
963-
; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
964-
; X86-NEXT: rolw $8, %ax
965-
; X86-NEXT: movl %eax, %ecx
966-
; X86-NEXT: andl $3855, %ecx # imm = 0xF0F
967-
; X86-NEXT: shll $4, %ecx
968-
; X86-NEXT: shrl $4, %eax
969-
; X86-NEXT: andl $3855, %eax # imm = 0xF0F
970-
; X86-NEXT: orl %ecx, %eax
971-
; X86-NEXT: movl %eax, %ecx
972-
; X86-NEXT: andl $13107, %ecx # imm = 0x3333
973-
; X86-NEXT: shrl $2, %eax
974-
; X86-NEXT: andl $13107, %eax # imm = 0x3333
975-
; X86-NEXT: leal (%eax,%ecx,4), %eax
976-
; X86-NEXT: movl %eax, %ecx
977-
; X86-NEXT: andl $21845, %ecx # imm = 0x5555
978-
; X86-NEXT: shrl %eax
979-
; X86-NEXT: andl $21845, %eax # imm = 0x5555
980-
; X86-NEXT: leal (%eax,%ecx,2), %eax
981-
; X86-NEXT: notl %eax
982-
; X86-NEXT: andw {{[0-9]+}}(%esp), %ax
983-
; X86-NEXT: # kill: def $ax killed $ax killed $eax
984-
; X86-NEXT: retl
979+
; X86-NOBMI-LABEL: andnot_bitreverse_i16:
980+
; X86-NOBMI: # %bb.0:
981+
; X86-NOBMI-NEXT: movzwl {{[0-9]+}}(%esp), %eax
982+
; X86-NOBMI-NEXT: rolw $8, %ax
983+
; X86-NOBMI-NEXT: movl %eax, %ecx
984+
; X86-NOBMI-NEXT: andl $3855, %ecx # imm = 0xF0F
985+
; X86-NOBMI-NEXT: shll $4, %ecx
986+
; X86-NOBMI-NEXT: shrl $4, %eax
987+
; X86-NOBMI-NEXT: andl $3855, %eax # imm = 0xF0F
988+
; X86-NOBMI-NEXT: orl %ecx, %eax
989+
; X86-NOBMI-NEXT: movl %eax, %ecx
990+
; X86-NOBMI-NEXT: andl $13107, %ecx # imm = 0x3333
991+
; X86-NOBMI-NEXT: shrl $2, %eax
992+
; X86-NOBMI-NEXT: andl $13107, %eax # imm = 0x3333
993+
; X86-NOBMI-NEXT: leal (%eax,%ecx,4), %eax
994+
; X86-NOBMI-NEXT: movl %eax, %ecx
995+
; X86-NOBMI-NEXT: andl $21845, %ecx # imm = 0x5555
996+
; X86-NOBMI-NEXT: shrl %eax
997+
; X86-NOBMI-NEXT: andl $21845, %eax # imm = 0x5555
998+
; X86-NOBMI-NEXT: leal (%eax,%ecx,2), %eax
999+
; X86-NOBMI-NEXT: notl %eax
1000+
; X86-NOBMI-NEXT: andw {{[0-9]+}}(%esp), %ax
1001+
; X86-NOBMI-NEXT: # kill: def $ax killed $ax killed $eax
1002+
; X86-NOBMI-NEXT: retl
1003+
;
1004+
; X86-BMI-LABEL: andnot_bitreverse_i16:
1005+
; X86-BMI: # %bb.0:
1006+
; X86-BMI-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1007+
; X86-BMI-NEXT: rolw $8, %ax
1008+
; X86-BMI-NEXT: movl %eax, %ecx
1009+
; X86-BMI-NEXT: andl $3855, %ecx # imm = 0xF0F
1010+
; X86-BMI-NEXT: shll $4, %ecx
1011+
; X86-BMI-NEXT: shrl $4, %eax
1012+
; X86-BMI-NEXT: andl $3855, %eax # imm = 0xF0F
1013+
; X86-BMI-NEXT: orl %ecx, %eax
1014+
; X86-BMI-NEXT: movl %eax, %ecx
1015+
; X86-BMI-NEXT: andl $13107, %ecx # imm = 0x3333
1016+
; X86-BMI-NEXT: shrl $2, %eax
1017+
; X86-BMI-NEXT: andl $13107, %eax # imm = 0x3333
1018+
; X86-BMI-NEXT: leal (%eax,%ecx,4), %edx
1019+
; X86-BMI-NEXT: andl $21845, %edx # imm = 0x5555
1020+
; X86-BMI-NEXT: addl %edx, %edx
1021+
; X86-BMI-NEXT: shll $2, %ecx
1022+
; X86-BMI-NEXT: notl %ecx
1023+
; X86-BMI-NEXT: andnl %ecx, %eax, %eax
1024+
; X86-BMI-NEXT: shrl %eax
1025+
; X86-BMI-NEXT: orl $43690, %eax # imm = 0xAAAA
1026+
; X86-BMI-NEXT: andnl %eax, %edx, %eax
1027+
; X86-BMI-NEXT: andw {{[0-9]+}}(%esp), %ax
1028+
; X86-BMI-NEXT: # kill: def $ax killed $ax killed $eax
1029+
; X86-BMI-NEXT: retl
9851030
;
9861031
; X64-NOBMI-LABEL: andnot_bitreverse_i16:
9871032
; X64-NOBMI: # %bb.0:
@@ -1019,16 +1064,19 @@ define i16 @andnot_bitreverse_i16(i16 %a0, i16 %a1) nounwind {
10191064
; X64-BMI-NEXT: andl $3855, %esi # imm = 0xF0F
10201065
; X64-BMI-NEXT: orl %eax, %esi
10211066
; X64-BMI-NEXT: movl %esi, %eax
1067+
; X64-BMI-NEXT: shrl $2, %eax
10221068
; X64-BMI-NEXT: andl $13107, %eax # imm = 0x3333
1023-
; X64-BMI-NEXT: shrl $2, %esi
10241069
; X64-BMI-NEXT: andl $13107, %esi # imm = 0x3333
1025-
; X64-BMI-NEXT: leal (%rsi,%rax,4), %eax
1026-
; X64-BMI-NEXT: movl %eax, %ecx
1027-
; X64-BMI-NEXT: andl $21845, %ecx # imm = 0x5555
1028-
; X64-BMI-NEXT: shrl %eax
1070+
; X64-BMI-NEXT: leal (,%rsi,4), %ecx
1071+
; X64-BMI-NEXT: notl %ecx
1072+
; X64-BMI-NEXT: andnl %ecx, %eax, %ecx
1073+
; X64-BMI-NEXT: shrl %ecx
1074+
; X64-BMI-NEXT: orl $-21846, %ecx # imm = 0xAAAA
1075+
; X64-BMI-NEXT: leal (%rax,%rsi,4), %eax
10291076
; X64-BMI-NEXT: andl $21845, %eax # imm = 0x5555
1030-
; X64-BMI-NEXT: leal (%rax,%rcx,2), %eax
1031-
; X64-BMI-NEXT: andnl %edi, %eax, %eax
1077+
; X64-BMI-NEXT: addl %eax, %eax
1078+
; X64-BMI-NEXT: andnl %ecx, %eax, %eax
1079+
; X64-BMI-NEXT: andl %edi, %eax
10321080
; X64-BMI-NEXT: # kill: def $ax killed $ax killed $eax
10331081
; X64-BMI-NEXT: retq
10341082
%not = xor i16 %a1, -1

0 commit comments

Comments
 (0)