Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AArch64] Improve codegen of volatile load/store of i128
Summary: Instead of generating two i64 instructions for each load or store of a volatile i128 value (two LDRs or STRs), now emit a single LDP or STP. Reviewers: labrinea, t.p.northover, efriedma Reviewed By: efriedma Subscribers: kristof.beyls, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69559
- Loading branch information
Showing
5 changed files
with
188 additions
and
18 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
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
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,117 @@ | ||
; RUN: llc -mtriple=aarch64 %s -o - | FileCheck %s | ||
|
||
@x = common dso_local global i128 0 | ||
@y = common dso_local global i128 0 | ||
|
||
define void @test1() { | ||
; CHECK-LABEL: test1: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: adrp x8, x | ||
; CHECK-NEXT: add x8, x8, :lo12:x | ||
; CHECK-NEXT: ldp x8, x9, [x8] | ||
; CHECK-NEXT: adrp x10, y | ||
; CHECK-NEXT: add x10, x10, :lo12:y | ||
; CHECK-NEXT: stp x8, x9, [x10] | ||
; CHECK-NEXT: ret | ||
%tmp = load volatile i128, i128* @x | ||
store volatile i128 %tmp, i128* @y | ||
ret void | ||
} | ||
|
||
define void @test2() { | ||
; CHECK-LABEL: test2: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: adrp x8, x | ||
; CHECK-NEXT: add x8, x8, :lo12:x | ||
; CHECK-NEXT: ldp x8, x9, [x8, #504] | ||
; CHECK-NEXT: adrp x10, y | ||
; CHECK-NEXT: add x10, x10, :lo12:y | ||
; CHECK-NEXT: stp x8, x9, [x10, #504] | ||
; CHECK-NEXT: ret | ||
%tmp = load volatile i128, i128* bitcast (i8* getelementptr (i8, i8* bitcast (i128* @x to i8*), i64 504) to i128*) | ||
store volatile i128 %tmp, i128* bitcast (i8* getelementptr (i8, i8* bitcast (i128* @y to i8*), i64 504) to i128*) | ||
ret void | ||
} | ||
|
||
define void @test3() { | ||
; CHECK-LABEL: test3: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: adrp x8, x | ||
; CHECK-NEXT: add x8, x8, :lo12:x | ||
; CHECK-NEXT: add x8, x8, #512 // =512 | ||
; CHECK-NEXT: ldp x8, x9, [x8] | ||
; CHECK-NEXT: adrp x10, y | ||
; CHECK-NEXT: add x10, x10, :lo12:y | ||
; CHECK-NEXT: add x10, x10, #512 // =512 | ||
; CHECK-NEXT: stp x8, x9, [x10] | ||
; CHECK-NEXT: ret | ||
%tmp = load volatile i128, i128* bitcast (i8* getelementptr (i8, i8* bitcast (i128* @x to i8*), i64 512) to i128*) | ||
store volatile i128 %tmp, i128* bitcast (i8* getelementptr (i8, i8* bitcast (i128* @y to i8*), i64 512) to i128*) | ||
ret void | ||
} | ||
|
||
define void @test4() { | ||
; CHECK-LABEL: test4: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: adrp x8, x | ||
; CHECK-NEXT: add x8, x8, :lo12:x | ||
; CHECK-NEXT: ldp x8, x9, [x8, #-512] | ||
; CHECK-NEXT: adrp x10, y | ||
; CHECK-NEXT: add x10, x10, :lo12:y | ||
; CHECK-NEXT: stp x8, x9, [x10, #-512] | ||
; CHECK-NEXT: ret | ||
%tmp = load volatile i128, i128* bitcast (i8* getelementptr (i8, i8* bitcast (i128* @x to i8*), i64 -512) to i128*) | ||
store volatile i128 %tmp, i128* bitcast (i8* getelementptr (i8, i8* bitcast (i128* @y to i8*), i64 -512) to i128*) | ||
ret void | ||
} | ||
|
||
define void @test5() { | ||
; CHECK-LABEL: test5: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: adrp x8, x | ||
; CHECK-NEXT: add x8, x8, :lo12:x | ||
; CHECK-NEXT: sub x8, x8, #520 // =520 | ||
; CHECK-NEXT: ldp x8, x9, [x8] | ||
; CHECK-NEXT: adrp x10, y | ||
; CHECK-NEXT: add x10, x10, :lo12:y | ||
; CHECK-NEXT: sub x10, x10, #520 // =520 | ||
; CHECK-NEXT: stp x8, x9, [x10] | ||
; CHECK-NEXT: ret | ||
%tmp = load volatile i128, i128* bitcast (i8* getelementptr (i8, i8* bitcast (i128* @x to i8*), i64 -520) to i128*) | ||
store volatile i128 %tmp, i128* bitcast (i8* getelementptr (i8, i8* bitcast (i128* @y to i8*), i64 -520) to i128*) | ||
ret void | ||
} | ||
|
||
define void @test6() { | ||
; CHECK-LABEL: test6: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: adrp x8, x | ||
; CHECK-NEXT: add x8, x8, :lo12:x | ||
; CHECK-NEXT: sub x8, x8, #520 // =520 | ||
; CHECK-NEXT: ldp x8, x9, [x8] | ||
; CHECK-NEXT: adrp x10, y | ||
; CHECK-NEXT: add x10, x10, :lo12:y | ||
; CHECK-NEXT: sub x10, x10, #520 // =520 | ||
; CHECK-NEXT: stp x8, x9, [x10] | ||
; CHECK-NEXT: ret | ||
%tmp = load volatile i128, i128* bitcast (i8* getelementptr (i8, i8* bitcast (i128* @x to i8*), i64 -520) to i128*) | ||
store volatile i128 %tmp, i128* bitcast (i8* getelementptr (i8, i8* bitcast (i128* @y to i8*), i64 -520) to i128*) | ||
ret void | ||
} | ||
|
||
define void @test7() { | ||
; CHECK-LABEL: test7: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: adrp x8, x | ||
; CHECK-NEXT: add x8, x8, :lo12:x | ||
; CHECK-NEXT: add x8, x8, #503 // =503 | ||
; CHECK-NEXT: ldp x8, x9, [x8] | ||
; CHECK-NEXT: adrp x10, y | ||
; CHECK-NEXT: add x10, x10, :lo12:y | ||
; CHECK-NEXT: add x10, x10, #503 // =503 | ||
; CHECK-NEXT: stp x8, x9, [x10] | ||
; CHECK-NEXT: ret | ||
%tmp = load volatile i128, i128* bitcast (i8* getelementptr (i8, i8* bitcast (i128* @x to i8*), i64 503) to i128*) | ||
store volatile i128 %tmp, i128* bitcast (i8* getelementptr (i8, i8* bitcast (i128* @y to i8*), i64 503) to i128*) | ||
ret void | ||
} |