diff options
| author | Tim Northover <tnorthover@apple.com> | 2017-06-26 20:34:13 +0000 |
|---|---|---|
| committer | Tim Northover <tnorthover@apple.com> | 2017-06-26 20:34:13 +0000 |
| commit | c2d5e6d63774c5d015c7b5e1b6822d854e1ac465 (patch) | |
| tree | b620d740100fbf0d9da4e3ffa5c00383466f167e /llvm/test/CodeGen/AArch64/GlobalISel | |
| parent | f6766bd2464bd5e405c5450cfa9daad7035d0ddb (diff) | |
| download | bcm5719-llvm-c2d5e6d63774c5d015c7b5e1b6822d854e1ac465.tar.gz bcm5719-llvm-c2d5e6d63774c5d015c7b5e1b6822d854e1ac465.zip | |
AArch64: legalize G_EXTRACT operations.
This is the dual problem to legalizing G_INSERTs so most of the code and
testing was cribbed from there.
llvm-svn: 306328
Diffstat (limited to 'llvm/test/CodeGen/AArch64/GlobalISel')
3 files changed, 92 insertions, 8 deletions
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-combines.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-combines.mir index e3e0175d39a..fbacc28d743 100644 --- a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-combines.mir +++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-combines.mir @@ -57,11 +57,11 @@ body: | %0:_(s64) = COPY %x0 ; CHECK-LABEL: name: test_combines_4 - ; CHECK: %2(<2 x s32>) = G_EXTRACT %1(s128), 0 - ; CHECK: %3(<2 x s32>) = G_ADD %2, %2 + ; CHECK: %2(s64) = COPY %0(s64) + ; CHECK: %3(s64) = G_ADD %2, %2 %1:_(s128) = G_MERGE_VALUES %0, %0 - %2:_(<2 x s32>) = G_EXTRACT %1, 0 - %3:_(<2 x s32>) = G_ADD %2, %2 + %2:_(s64) = G_EXTRACT %1, 0 + %3:_(s64) = G_ADD %2, %2 ... --- diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-exceptions.ll b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-exceptions.ll index 23e7d5163e5..d2452b86170 100644 --- a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-exceptions.ll +++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-exceptions.ll @@ -22,12 +22,11 @@ declare void @_Unwind_Resume(i8*) ; CHECK: [[SEL:%[0-9]+]](s32) = G_PTRTOINT [[SEL_PTR]] ; CHECK: [[STRUCT_SEL:%[0-9]+]](s64) = G_INSERT {{%[0-9]+}}, [[SEL]](s32), 0 -; CHECK: [[STRUCT:%[0-9]+]](s128) = G_MERGE_VALUES [[STRUCT_PTR]](s64), [[STRUCT_SEL]] - -; CHECK: [[PTR:%[0-9]+]](p0) = G_EXTRACT [[STRUCT]](s128), 0 +; CHECK: [[PTR:%[0-9]+]](p0) = COPY [[STRUCT_PTR]](s64) ; CHECK: G_STORE [[PTR]](p0), {{%[0-9]+}}(p0) -; CHECK: [[SEL:%[0-9]+]](s32) = G_EXTRACT [[STRUCT]](s128), 64 +; CHECK: [[SEL_TMP:%[0-9]+]](s32) = G_EXTRACT [[STRUCT_SEL]](s64), 0 +; CHECK: [[SEL:%[0-9]+]](s32) = COPY [[SEL_TMP]] ; CHECK: G_STORE [[SEL]](s32), {{%[0-9]+}}(p0) define void @bar() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-extracts.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-extracts.mir new file mode 100644 index 00000000000..dc6b59b24a9 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-extracts.mir @@ -0,0 +1,85 @@ +# RUN: llc -mtriple=aarch64-linux-gnu -O0 -run-pass=legalizer -global-isel %s -o - | FileCheck %s + +--- +name: test_extracts_1 +body: | + bb.0: + liveins: %w0 + + ; Low part of extraction takes entirity of the low register entirely, so + ; value stored is forwarded directly from first load. + + ; CHECK-LABEL: name: test_extracts_1 + ; CHECK: [[LO:%[0-9]+]](s64) = G_LOAD + ; CHECK: {{%[0-9]+}}(s64) = G_LOAD + ; CHECK: [[VAL:%[0-9]+]](s64) = COPY [[LO]] + ; CHECK: G_STORE [[VAL]] + %0:_(s64) = COPY %x0 + %1:_(s32) = COPY %w1 + %2:_(p0) = COPY %x2 + %3:_(s128) = G_LOAD %2(p0) :: (load 16) + %4:_(s64) = G_EXTRACT %3(s128), 0 + G_STORE %4(s64), %2(p0) :: (store 8) + RET_ReallyLR +... + +--- +name: test_extracts_2 +body: | + bb.0: + liveins: %w0 + + ; Low extraction wipes takes whole low register. High extraction is real. + ; CHECK-LABEL: name: test_extracts_2 + ; CHECK: [[LO_TMP:%[0-9]+]](s64) = G_LOAD + ; CHECK: [[HI:%[0-9]+]](s64) = G_LOAD + ; CHECK: [[LO:%[0-9]+]](s64) = COPY [[LO_TMP]] + ; CHECK: [[NEWHI_TMP:%[0-9]+]](s32) = G_EXTRACT [[HI]](s64), 0 + ; CHECK: [[NEWHI:%[0-9]+]](s32) = COPY [[NEWHI_TMP]] + ; CHECK: G_STORE [[LO]] + ; CHECK: G_STORE [[NEWHI]] + %0:_(s64) = COPY %x0 + %1:_(s32) = COPY %w1 + %2:_(p0) = COPY %x2 + %3:_(s128) = G_LOAD %2(p0) :: (load 16) + %4:_(s64) = G_EXTRACT %3(s128), 0 + %5:_(s32) = G_EXTRACT %3(s128), 64 + G_STORE %4(s64), %2(p0) :: (store 8) + G_STORE %5(s32), %2(p0) :: (store 4) + RET_ReallyLR +... + +--- +name: test_extracts_3 +body: | + bb.0: + liveins: %x0, %x1, %x2 + + + ; CHECK-LABEL: name: test_extracts_3 + ; CHECK: [[LO:%[0-9]+]](s32) = G_EXTRACT %0(s64), 32 + ; CHECK: [[HI:%[0-9]+]](s32) = G_EXTRACT %1(s64), 0 + ; CHECK: %3(s64) = G_MERGE_VALUES [[LO]](s32), [[HI]](s32) + %0:_(s64) = COPY %x0 + %1:_(s64) = COPY %x1 + %2:_(s128) = G_MERGE_VALUES %0, %1 + %3:_(s64) = G_EXTRACT %2, 32 + RET_ReallyLR +... + +--- +name: test_extracts_4 +body: | + bb.0: + liveins: %x0, %x1, %x2 + + + ; CHECK-LABEL: name: test_extracts_4 + ; CHECK: [[LO_TMP:%[0-9]+]](s32) = G_EXTRACT %0(s64), 32 + ; CHECK: %3(s32) = COPY [[LO_TMP]] + %0:_(s64) = COPY %x0 + %1:_(s64) = COPY %x1 + %2:_(s128) = G_MERGE_VALUES %0, %1 + %3:_(s32) = G_EXTRACT %2, 32 + RET_ReallyLR +... |

