Skip to content

Commit d06fb90

Browse files
committed
AArch64 adding more tests to show the simple scenarios for or/and combine
1 parent 1206a18 commit d06fb90

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

llvm/test/CodeGen/AArch64/arm64-rev.ll

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,3 +882,71 @@ entry:
882882
%16 = or i64 %15, %14
883883
ret i64 %16
884884
}
885+
886+
define i64 @test_or_and_combine1(i64 %a) nounwind {
887+
; CHECK-LABEL: test_or_and_combine1:
888+
; CHECK: // %bb.0: // %entry
889+
; CHECK-NEXT: lsr x8, x0, #24
890+
; CHECK-NEXT: lsr x9, x0, #8
891+
; CHECK-NEXT: and x10, x9, #0xff000000000000
892+
; CHECK-NEXT: bfi x10, x8, #32, #8
893+
; CHECK-NEXT: and x8, x9, #0xff0000
894+
; CHECK-NEXT: orr x0, x10, x8
895+
; CHECK-NEXT: ret
896+
;
897+
; GISEL-LABEL: test_or_and_combine1:
898+
; GISEL: // %bb.0: // %entry
899+
; GISEL-NEXT: lsr x8, x0, #8
900+
; GISEL-NEXT: lsl x9, x0, #8
901+
; GISEL-NEXT: and x10, x8, #0xff000000000000
902+
; GISEL-NEXT: and x9, x9, #0xff00000000
903+
; GISEL-NEXT: orr x9, x10, x9
904+
; GISEL-NEXT: and x8, x8, #0xff0000
905+
; GISEL-NEXT: orr x0, x9, x8
906+
; GISEL-NEXT: ret
907+
entry:
908+
%0 = lshr i64 %a, 8
909+
%1 = and i64 %0, 71776119061217280
910+
%2 = shl i64 %a, 8
911+
%3 = and i64 %2, 1095216660480
912+
%4 = or i64 %1, %3
913+
%5 = and i64 %0, 16711680
914+
%6 = or i64 %4, %5
915+
ret i64 %6
916+
}
917+
918+
define i64 @test_or_and_combine2(i64 %a, i64 %b) nounwind {
919+
; CHECK-LABEL: test_or_and_combine2:
920+
; CHECK: // %bb.0: // %entry
921+
; CHECK-NEXT: lsr x8, x0, #8
922+
; CHECK-NEXT: lsl x10, x0, #8
923+
; CHECK-NEXT: and x9, x8, #0xff000000000000
924+
; CHECK-NEXT: and x8, x8, #0xff0000
925+
; CHECK-NEXT: orr x9, x9, x10
926+
; CHECK-NEXT: and x10, x10, #0xff00000000
927+
; CHECK-NEXT: orr x9, x9, x10
928+
; CHECK-NEXT: orr x0, x9, x8
929+
; CHECK-NEXT: ret
930+
;
931+
; GISEL-LABEL: test_or_and_combine2:
932+
; GISEL: // %bb.0: // %entry
933+
; GISEL-NEXT: lsr x8, x0, #8
934+
; GISEL-NEXT: lsl x10, x0, #8
935+
; GISEL-NEXT: and x9, x8, #0xff000000000000
936+
; GISEL-NEXT: and x8, x8, #0xff0000
937+
; GISEL-NEXT: orr x9, x9, x10
938+
; GISEL-NEXT: and x10, x10, #0xff00000000
939+
; GISEL-NEXT: orr x9, x9, x10
940+
; GISEL-NEXT: orr x0, x9, x8
941+
; GISEL-NEXT: ret
942+
entry:
943+
%0 = lshr i64 %a, 8
944+
%1 = and i64 %0, 71776119061217280
945+
%2 = shl i64 %a, 8
946+
%3 = or i64 %1, %2
947+
%4 = and i64 %2, 1095216660480
948+
%5 = or i64 %3, %4
949+
%6 = and i64 %0, 16711680
950+
%7 = or i64 %5, %6
951+
ret i64 %7
952+
}

0 commit comments

Comments
 (0)