forked from brson/llvm
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FastISel][AArch64] Fold offset into the memory operation.
Fold simple offsets into the memory operation: add x0, x0, brson#8 ldr x0, [x0] --> ldr x0, [x0, brson#8] Fixes <rdar://problem/17887945>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214545 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
; RUN: llc -fast-isel -fast-isel-abort -mtriple=arm64-apple-darwin < %s | FileCheck %s | ||
|
||
; Test simple constant offset. | ||
define i64 @test_load1(i64 %a) { | ||
; CHECK-LABEL: test_load1 | ||
; CHECK: ldr x0, [x0, #16] | ||
%1 = add i64 %a, 16 | ||
%2 = inttoptr i64 %1 to i64* | ||
%3 = load i64* %2 | ||
ret i64 %3 | ||
} | ||
|
||
; Test large constant offset. | ||
define i64 @test_load2(i64 %a) { | ||
; CHECK-LABEL: test_load2 | ||
; CHECK: add [[REG:x[0-9]+]], x0, {{x[0-9]+}} | ||
; CHECK: ldr x0, {{\[}}[[REG]]{{\]}} | ||
%1 = add i64 %a, 16777216 | ||
%2 = inttoptr i64 %1 to i64* | ||
%3 = load i64* %2 | ||
ret i64 %3 | ||
} | ||
|