diff options
| author | Jessica Paquette <jpaquette@apple.com> | 2019-03-14 22:54:29 +0000 |
|---|---|---|
| committer | Jessica Paquette <jpaquette@apple.com> | 2019-03-14 22:54:29 +0000 |
| commit | 7d6784f5225b19867eb7702e4ff9b3c3b06dfb7b (patch) | |
| tree | e517e72bc90b5170dcd51818f4f06daeefd8b7a5 /llvm/test/CodeGen | |
| parent | d61b89be8d73d09c9507c28826a468c5ee8f11fc (diff) | |
| download | bcm5719-llvm-7d6784f5225b19867eb7702e4ff9b3c3b06dfb7b.tar.gz bcm5719-llvm-7d6784f5225b19867eb7702e4ff9b3c3b06dfb7b.zip | |
[AArch64][GlobalISel] Add isel support for G_UADDO on s32s and s64s
This adds instruction selection support for G_UADDO on s32s and s64s.
Also
- Add an instruction selection test
- Update the arm64-xaluo.ll test to show that we generate the correct assembly
Differential Revision: https://reviews.llvm.org/D58734
llvm-svn: 356214
Diffstat (limited to 'llvm/test/CodeGen')
| -rw-r--r-- | llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir | 2 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/GlobalISel/select-uaddo.mir | 62 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/arm64-xaluo.ll | 9 |
3 files changed, 72 insertions, 1 deletions
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir index 7a7e5af1e8d..06cc39187e7 100644 --- a/llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir +++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir @@ -199,7 +199,7 @@ # DEBUG: .. the first uncovered type index: 2, OK # # DEBUG-NEXT: G_UADDO (opcode {{[0-9]+}}): 2 type indices -# DEBUG: .. type index coverage check SKIPPED: no rules defined +# DEBUG: .. the first uncovered type index: 2, OK # # DEBUG-NEXT: G_UADDE (opcode {{[0-9]+}}): 2 type indices # DEBUG: .. the first uncovered type index: 2, OK diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/select-uaddo.mir b/llvm/test/CodeGen/AArch64/GlobalISel/select-uaddo.mir new file mode 100644 index 00000000000..6012bbe1fd6 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/GlobalISel/select-uaddo.mir @@ -0,0 +1,62 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -verify-machineinstrs -mtriple aarch64-unknown-uknown -global-isel -run-pass=instruction-select %s -o - | FileCheck %s + +... +--- +name: uaddo_s32 +alignment: 2 +legalized: true +regBankSelected: true +tracksRegLiveness: true +body: | + bb.1.entry: + liveins: $w0, $w1, $x2 + + ; CHECK-LABEL: name: uaddo_s32 + ; CHECK: liveins: $w0, $w1, $x2 + ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0 + ; CHECK: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1 + ; CHECK: [[ADDSWrr:%[0-9]+]]:gpr32 = ADDSWrr [[COPY]], [[COPY1]], implicit-def $nzcv + ; CHECK: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr $wzr, $wzr, 3, implicit $nzcv + ; CHECK: [[UBFMWri:%[0-9]+]]:gpr32 = UBFMWri [[CSINCWr]], 0, 0 + ; CHECK: [[UBFMWri1:%[0-9]+]]:gpr32 = UBFMWri [[UBFMWri]], 0, 7 + ; CHECK: $w0 = COPY [[UBFMWri1]] + ; CHECK: RET_ReallyLR implicit $w0 + %0:gpr(s32) = COPY $w0 + %1:gpr(s32) = COPY $w1 + %3:gpr(s32), %4:gpr(s1) = G_UADDO %0, %1 + %5:gpr(s8) = G_ZEXT %4(s1) + %6:gpr(s32) = G_ZEXT %5(s8) + $w0 = COPY %6(s32) + RET_ReallyLR implicit $w0 + +... +--- +name: uaddo_s64 +alignment: 2 +legalized: true +regBankSelected: true +tracksRegLiveness: true +body: | + bb.1.entry: + liveins: $x0, $x1, $x2 + + ; CHECK-LABEL: name: uaddo_s64 + ; CHECK: liveins: $x0, $x1, $x2 + ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0 + ; CHECK: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1 + ; CHECK: [[ADDSXrr:%[0-9]+]]:gpr64 = ADDSXrr [[COPY]], [[COPY1]], implicit-def $nzcv + ; CHECK: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr $wzr, $wzr, 3, implicit $nzcv + ; CHECK: [[UBFMWri:%[0-9]+]]:gpr32 = UBFMWri [[CSINCWr]], 0, 0 + ; CHECK: [[UBFMWri1:%[0-9]+]]:gpr32 = UBFMWri [[UBFMWri]], 0, 7 + ; CHECK: $w0 = COPY [[UBFMWri1]] + ; CHECK: RET_ReallyLR implicit $w0 + %0:gpr(s64) = COPY $x0 + %1:gpr(s64) = COPY $x1 + %3:gpr(s64), %4:gpr(s1) = G_UADDO %0, %1 + %5:gpr(s8) = G_ZEXT %4(s1) + %6:gpr(s32) = G_ZEXT %5(s8) + $w0 = COPY %6(s32) + RET_ReallyLR implicit $w0 + +... diff --git a/llvm/test/CodeGen/AArch64/arm64-xaluo.ll b/llvm/test/CodeGen/AArch64/arm64-xaluo.ll index fc167d2f34d..6ae5b355641 100644 --- a/llvm/test/CodeGen/AArch64/arm64-xaluo.ll +++ b/llvm/test/CodeGen/AArch64/arm64-xaluo.ll @@ -1,5 +1,6 @@ ; RUN: llc < %s -mtriple=arm64-eabi -aarch64-enable-atomic-cfg-tidy=0 -disable-post-ra -verify-machineinstrs | FileCheck %s ; RUN: llc < %s -mtriple=arm64-eabi -aarch64-enable-atomic-cfg-tidy=0 -fast-isel -fast-isel-abort=1 -disable-post-ra -verify-machineinstrs | FileCheck %s +; RUN: llc < %s -mtriple=arm64-eabi -aarch64-enable-atomic-cfg-tidy=0 -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel* -disable-post-ra -verify-machineinstrs | FileCheck %s --check-prefixes=GISEL,FALLBACK ; ; Get the actual value of the overflow bit. @@ -105,11 +106,15 @@ entry: ret i1 %obit } +; FALLBACK-NOT: remark{{.*}}uaddo.i32 define zeroext i1 @uaddo.i32(i32 %v1, i32 %v2, i32* %res) { entry: ; CHECK-LABEL: uaddo.i32 ; CHECK: adds {{w[0-9]+}}, w0, w1 ; CHECK-NEXT: cset {{w[0-9]+}}, hs +; GISEL-LABEL: uaddo.i32 +; GISEL: adds {{w[0-9]+}}, w0, w1 +; GISEL-NEXT: cset {{w[0-9]+}}, hs %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %v1, i32 %v2) %val = extractvalue {i32, i1} %t, 0 %obit = extractvalue {i32, i1} %t, 1 @@ -117,11 +122,15 @@ entry: ret i1 %obit } +; FALLBACK-NOT: remark{{.*}}uaddo.i64 define zeroext i1 @uaddo.i64(i64 %v1, i64 %v2, i64* %res) { entry: ; CHECK-LABEL: uaddo.i64 ; CHECK: adds {{x[0-9]+}}, x0, x1 ; CHECK-NEXT: cset {{w[0-9]+}}, hs +; GISEL-LABEL: uaddo.i64 +; GISEL: adds {{x[0-9]+}}, x0, x1 +; GISEL-NEXT: cset {{w[0-9]+}}, hs %t = call {i64, i1} @llvm.uadd.with.overflow.i64(i64 %v1, i64 %v2) %val = extractvalue {i64, i1} %t, 0 %obit = extractvalue {i64, i1} %t, 1 |

