mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
AArch64/ARM64: print BFM instructions as BFI or BFXIL
The canonical form of the BFM instruction is always one of the more explicit extract or insert operations, which makes reading output much easier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207752 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -8,10 +8,7 @@
|
||||
|
||||
define [1 x i64] @from_clang([1 x i64] %f.coerce, i32 %n) nounwind readnone {
|
||||
; CHECK-LABEL: from_clang:
|
||||
; CHECK-AARCH64: bfi w0, w1, #3, #4
|
||||
; CHECK-ARCH64-NEXT: ret
|
||||
|
||||
; CHECK-ARM64: bfm {{w[0-9]+}}, {{w[0-9]+}}, #29, #3
|
||||
; CHECK: bfi {{w[0-9]+}}, {{w[0-9]+}}, #3, #4
|
||||
|
||||
entry:
|
||||
%f.coerce.fca.0.extract = extractvalue [1 x i64] %f.coerce, 0
|
||||
@@ -30,8 +27,7 @@ entry:
|
||||
define void @test_whole32(i32* %existing, i32* %new) {
|
||||
; CHECK-LABEL: test_whole32:
|
||||
|
||||
; CHECK-AARCH64: bfi {{w[0-9]+}}, {{w[0-9]+}}, #26, #5
|
||||
; CHECK-ARM64: bfm {{w[0-9]+}}, {{w[0-9]+}}, #6, #4
|
||||
; CHECK: bfi {{w[0-9]+}}, {{w[0-9]+}}, #26, #5
|
||||
|
||||
%oldval = load volatile i32* %existing
|
||||
%oldval_keep = and i32 %oldval, 2214592511 ; =0x83ffffff
|
||||
@@ -48,8 +44,7 @@ define void @test_whole32(i32* %existing, i32* %new) {
|
||||
|
||||
define void @test_whole64(i64* %existing, i64* %new) {
|
||||
; CHECK-LABEL: test_whole64:
|
||||
; CHECK-AARCH64: bfi {{x[0-9]+}}, {{x[0-9]+}}, #26, #14
|
||||
; CHECK-ARM64: bfm {{x[0-9]+}}, {{x[0-9]+}}, #38, #13
|
||||
; CHECK: bfi {{x[0-9]+}}, {{x[0-9]+}}, #26, #14
|
||||
; CHECK-NOT: and
|
||||
; CHECK: ret
|
||||
|
||||
@@ -71,7 +66,8 @@ define void @test_whole32_from64(i64* %existing, i64* %new) {
|
||||
|
||||
; CHECK-AARCH64: bfi {{w[0-9]+}}, {{w[0-9]+}}, #{{0|16}}, #16
|
||||
; CHECK-AARCH64-NOT: and
|
||||
; CHECK-ARM64: bfm {{x[0-9]+}}, {{x[0-9]+}}, #0, #15
|
||||
|
||||
; CHECK-ARM64: bfxil {{x[0-9]+}}, {{x[0-9]+}}, #0, #16
|
||||
|
||||
; CHECK: ret
|
||||
|
||||
@@ -90,11 +86,9 @@ define void @test_whole32_from64(i64* %existing, i64* %new) {
|
||||
define void @test_32bit_masked(i32 *%existing, i32 *%new) {
|
||||
; CHECK-LABEL: test_32bit_masked:
|
||||
|
||||
; CHECK-AARCH64: bfi [[INSERT:w[0-9]+]], {{w[0-9]+}}, #3, #4
|
||||
; CHECK-AARCH64: and {{w[0-9]+}}, [[INSERT]], #0xff
|
||||
|
||||
; CHECK-ARM64: and
|
||||
; CHECK-ARM64: bfm {{w[0-9]+}}, {{w[0-9]+}}, #29, #3
|
||||
; CHECK: bfi [[INSERT:w[0-9]+]], {{w[0-9]+}}, #3, #4
|
||||
; CHECK-AARCH64: and {{w[0-9]+}}, [[INSERT]], #0xff
|
||||
|
||||
%oldval = load volatile i32* %existing
|
||||
%oldval_keep = and i32 %oldval, 135 ; = 0x87
|
||||
@@ -111,11 +105,9 @@ define void @test_32bit_masked(i32 *%existing, i32 *%new) {
|
||||
|
||||
define void @test_64bit_masked(i64 *%existing, i64 *%new) {
|
||||
; CHECK-LABEL: test_64bit_masked:
|
||||
; CHECK-AARCH64: bfi [[INSERT:x[0-9]+]], {{x[0-9]+}}, #40, #8
|
||||
; CHECK-AARCH64: and {{x[0-9]+}}, [[INSERT]], #0xffff00000000
|
||||
|
||||
; CHECK-ARM64: and
|
||||
; CHECK-ARM64: bfm {{x[0-9]+}}, {{x[0-9]+}}, #24, #7
|
||||
; CHECK: bfi [[INSERT:x[0-9]+]], {{x[0-9]+}}, #40, #8
|
||||
; CHECK-AARCH64: and {{x[0-9]+}}, [[INSERT]], #0xffff00000000
|
||||
|
||||
%oldval = load volatile i64* %existing
|
||||
%oldval_keep = and i64 %oldval, 1095216660480 ; = 0xff_0000_0000
|
||||
@@ -134,11 +126,9 @@ define void @test_64bit_masked(i64 *%existing, i64 *%new) {
|
||||
define void @test_32bit_complexmask(i32 *%existing, i32 *%new) {
|
||||
; CHECK-LABEL: test_32bit_complexmask:
|
||||
|
||||
; CHECK-AARCH64: bfi {{w[0-9]+}}, {{w[0-9]+}}, #3, #4
|
||||
; CHECK-AARCH64: and {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
|
||||
|
||||
; CHECK-ARM64: and
|
||||
; CHECK-ARM64: bfm {{w[0-9]+}}, {{w[0-9]+}}, #29, #3
|
||||
; CHECK: bfi {{w[0-9]+}}, {{w[0-9]+}}, #3, #4
|
||||
; CHECK-AARCH64: and {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
|
||||
|
||||
%oldval = load volatile i32* %existing
|
||||
%oldval_keep = and i32 %oldval, 647 ; = 0x287
|
||||
@@ -208,8 +198,7 @@ define void @test_32bit_with_shr(i32* %existing, i32* %new) {
|
||||
%combined = or i32 %oldval_keep, %newval_masked
|
||||
store volatile i32 %combined, i32* %existing
|
||||
; CHECK: lsr [[BIT:w[0-9]+]], {{w[0-9]+}}, #14
|
||||
; CHECK-AARCH64: bfi {{w[0-9]+}}, [[BIT]], #26, #5
|
||||
; CHECK-ARM64: bfm {{w[0-9]+}}, [[BIT]], #6, #4
|
||||
; CHECK: bfi {{w[0-9]+}}, [[BIT]], #26, #5
|
||||
|
||||
ret void
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user