| # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py |
| # RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32 |
| --- | |
| |
| define void @sub_i32() {entry: ret void} |
| define void @sub_i8_sext() {entry: ret void} |
| define void @sub_i8_zext() {entry: ret void} |
| define void @sub_i8_aext() {entry: ret void} |
| define void @sub_i16_sext() {entry: ret void} |
| define void @sub_i16_zext() {entry: ret void} |
| define void @sub_i16_aext() {entry: ret void} |
| define void @sub_i64() {entry: ret void} |
| define void @sub_i128() {entry: ret void} |
| |
| ... |
| --- |
| name: sub_i32 |
| alignment: 4 |
| tracksRegLiveness: true |
| body: | |
| bb.1.entry: |
| liveins: $a0, $a1 |
| |
| ; MIPS32-LABEL: name: sub_i32 |
| ; MIPS32: liveins: $a0, $a1 |
| ; MIPS32-NEXT: {{ $}} |
| ; MIPS32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0 |
| ; MIPS32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1 |
| ; MIPS32-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[COPY1]] |
| ; MIPS32-NEXT: $v0 = COPY [[SUB]](s32) |
| ; MIPS32-NEXT: RetRA implicit $v0 |
| %0:_(s32) = COPY $a0 |
| %1:_(s32) = COPY $a1 |
| %2:_(s32) = G_SUB %0, %1 |
| $v0 = COPY %2(s32) |
| RetRA implicit $v0 |
| |
| ... |
| --- |
| name: sub_i8_sext |
| alignment: 4 |
| tracksRegLiveness: true |
| body: | |
| bb.1.entry: |
| liveins: $a0, $a1 |
| |
| ; MIPS32-LABEL: name: sub_i8_sext |
| ; MIPS32: liveins: $a0, $a1 |
| ; MIPS32-NEXT: {{ $}} |
| ; MIPS32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0 |
| ; MIPS32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1 |
| ; MIPS32-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY1]], [[COPY]] |
| ; MIPS32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24 |
| ; MIPS32-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[SUB]], [[C]](s32) |
| ; MIPS32-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32) |
| ; MIPS32-NEXT: $v0 = COPY [[ASHR]](s32) |
| ; MIPS32-NEXT: RetRA implicit $v0 |
| %2:_(s32) = COPY $a0 |
| %0:_(s8) = G_TRUNC %2(s32) |
| %3:_(s32) = COPY $a1 |
| %1:_(s8) = G_TRUNC %3(s32) |
| %4:_(s8) = G_SUB %1, %0 |
| %5:_(s32) = G_SEXT %4(s8) |
| $v0 = COPY %5(s32) |
| RetRA implicit $v0 |
| |
| ... |
| --- |
| name: sub_i8_zext |
| alignment: 4 |
| tracksRegLiveness: true |
| body: | |
| bb.1.entry: |
| liveins: $a0, $a1 |
| |
| ; MIPS32-LABEL: name: sub_i8_zext |
| ; MIPS32: liveins: $a0, $a1 |
| ; MIPS32-NEXT: {{ $}} |
| ; MIPS32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0 |
| ; MIPS32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1 |
| ; MIPS32-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY1]], [[COPY]] |
| ; MIPS32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 |
| ; MIPS32-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[SUB]], [[C]] |
| ; MIPS32-NEXT: $v0 = COPY [[AND]](s32) |
| ; MIPS32-NEXT: RetRA implicit $v0 |
| %2:_(s32) = COPY $a0 |
| %0:_(s8) = G_TRUNC %2(s32) |
| %3:_(s32) = COPY $a1 |
| %1:_(s8) = G_TRUNC %3(s32) |
| %4:_(s8) = G_SUB %1, %0 |
| %5:_(s32) = G_ZEXT %4(s8) |
| $v0 = COPY %5(s32) |
| RetRA implicit $v0 |
| |
| ... |
| --- |
| name: sub_i8_aext |
| alignment: 4 |
| tracksRegLiveness: true |
| body: | |
| bb.1.entry: |
| liveins: $a0, $a1 |
| |
| ; MIPS32-LABEL: name: sub_i8_aext |
| ; MIPS32: liveins: $a0, $a1 |
| ; MIPS32-NEXT: {{ $}} |
| ; MIPS32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0 |
| ; MIPS32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1 |
| ; MIPS32-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY1]], [[COPY]] |
| ; MIPS32-NEXT: $v0 = COPY [[SUB]](s32) |
| ; MIPS32-NEXT: RetRA implicit $v0 |
| %2:_(s32) = COPY $a0 |
| %0:_(s8) = G_TRUNC %2(s32) |
| %3:_(s32) = COPY $a1 |
| %1:_(s8) = G_TRUNC %3(s32) |
| %4:_(s8) = G_SUB %1, %0 |
| %5:_(s32) = G_ANYEXT %4(s8) |
| $v0 = COPY %5(s32) |
| RetRA implicit $v0 |
| |
| ... |
| --- |
| name: sub_i16_sext |
| alignment: 4 |
| tracksRegLiveness: true |
| body: | |
| bb.1.entry: |
| liveins: $a0, $a1 |
| |
| ; MIPS32-LABEL: name: sub_i16_sext |
| ; MIPS32: liveins: $a0, $a1 |
| ; MIPS32-NEXT: {{ $}} |
| ; MIPS32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0 |
| ; MIPS32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1 |
| ; MIPS32-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY1]], [[COPY]] |
| ; MIPS32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 |
| ; MIPS32-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[SUB]], [[C]](s32) |
| ; MIPS32-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32) |
| ; MIPS32-NEXT: $v0 = COPY [[ASHR]](s32) |
| ; MIPS32-NEXT: RetRA implicit $v0 |
| %2:_(s32) = COPY $a0 |
| %0:_(s16) = G_TRUNC %2(s32) |
| %3:_(s32) = COPY $a1 |
| %1:_(s16) = G_TRUNC %3(s32) |
| %4:_(s16) = G_SUB %1, %0 |
| %5:_(s32) = G_SEXT %4(s16) |
| $v0 = COPY %5(s32) |
| RetRA implicit $v0 |
| |
| ... |
| --- |
| name: sub_i16_zext |
| alignment: 4 |
| tracksRegLiveness: true |
| body: | |
| bb.1.entry: |
| liveins: $a0, $a1 |
| |
| ; MIPS32-LABEL: name: sub_i16_zext |
| ; MIPS32: liveins: $a0, $a1 |
| ; MIPS32-NEXT: {{ $}} |
| ; MIPS32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0 |
| ; MIPS32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1 |
| ; MIPS32-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY1]], [[COPY]] |
| ; MIPS32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 |
| ; MIPS32-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[SUB]], [[C]] |
| ; MIPS32-NEXT: $v0 = COPY [[AND]](s32) |
| ; MIPS32-NEXT: RetRA implicit $v0 |
| %2:_(s32) = COPY $a0 |
| %0:_(s16) = G_TRUNC %2(s32) |
| %3:_(s32) = COPY $a1 |
| %1:_(s16) = G_TRUNC %3(s32) |
| %4:_(s16) = G_SUB %1, %0 |
| %5:_(s32) = G_ZEXT %4(s16) |
| $v0 = COPY %5(s32) |
| RetRA implicit $v0 |
| |
| ... |
| --- |
| name: sub_i16_aext |
| alignment: 4 |
| tracksRegLiveness: true |
| body: | |
| bb.1.entry: |
| liveins: $a0, $a1 |
| |
| ; MIPS32-LABEL: name: sub_i16_aext |
| ; MIPS32: liveins: $a0, $a1 |
| ; MIPS32-NEXT: {{ $}} |
| ; MIPS32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0 |
| ; MIPS32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1 |
| ; MIPS32-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY1]], [[COPY]] |
| ; MIPS32-NEXT: $v0 = COPY [[SUB]](s32) |
| ; MIPS32-NEXT: RetRA implicit $v0 |
| %2:_(s32) = COPY $a0 |
| %0:_(s16) = G_TRUNC %2(s32) |
| %3:_(s32) = COPY $a1 |
| %1:_(s16) = G_TRUNC %3(s32) |
| %4:_(s16) = G_SUB %1, %0 |
| %5:_(s32) = G_ANYEXT %4(s16) |
| $v0 = COPY %5(s32) |
| RetRA implicit $v0 |
| |
| ... |
| --- |
| name: sub_i64 |
| alignment: 4 |
| tracksRegLiveness: true |
| body: | |
| bb.1.entry: |
| liveins: $a0, $a1, $a2, $a3 |
| |
| ; MIPS32-LABEL: name: sub_i64 |
| ; MIPS32: liveins: $a0, $a1, $a2, $a3 |
| ; MIPS32-NEXT: {{ $}} |
| ; MIPS32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0 |
| ; MIPS32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1 |
| ; MIPS32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2 |
| ; MIPS32-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3 |
| ; MIPS32-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY3]], [[COPY1]] |
| ; MIPS32-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY3]](s32), [[COPY1]] |
| ; MIPS32-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[COPY2]], [[COPY]] |
| ; MIPS32-NEXT: [[SUB2:%[0-9]+]]:_(s32) = G_SUB [[SUB1]], [[ICMP]] |
| ; MIPS32-NEXT: $v0 = COPY [[SUB2]](s32) |
| ; MIPS32-NEXT: $v1 = COPY [[SUB]](s32) |
| ; MIPS32-NEXT: RetRA implicit $v0, implicit $v1 |
| %2:_(s32) = COPY $a0 |
| %3:_(s32) = COPY $a1 |
| %0:_(s64) = G_MERGE_VALUES %3(s32), %2(s32) |
| %4:_(s32) = COPY $a2 |
| %5:_(s32) = COPY $a3 |
| %1:_(s64) = G_MERGE_VALUES %5(s32), %4(s32) |
| %6:_(s64) = G_SUB %1, %0 |
| %7:_(s32), %8:_(s32) = G_UNMERGE_VALUES %6(s64) |
| $v0 = COPY %8(s32) |
| $v1 = COPY %7(s32) |
| RetRA implicit $v0, implicit $v1 |
| |
| ... |
| --- |
| name: sub_i128 |
| alignment: 4 |
| tracksRegLiveness: true |
| fixedStack: |
| - { id: 0, offset: 28, size: 4, alignment: 4, stack-id: default, isImmutable: true } |
| - { id: 1, offset: 24, size: 4, alignment: 8, stack-id: default, isImmutable: true } |
| - { id: 2, offset: 20, size: 4, alignment: 4, stack-id: default, isImmutable: true } |
| - { id: 3, offset: 16, size: 4, alignment: 8, stack-id: default, isImmutable: true } |
| body: | |
| bb.1.entry: |
| liveins: $a0, $a1, $a2, $a3 |
| |
| ; MIPS32-LABEL: name: sub_i128 |
| ; MIPS32: liveins: $a0, $a1, $a2, $a3 |
| ; MIPS32-NEXT: {{ $}} |
| ; MIPS32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0 |
| ; MIPS32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1 |
| ; MIPS32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2 |
| ; MIPS32-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3 |
| ; MIPS32-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0 |
| ; MIPS32-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load (s32) from %fixed-stack.0, align 8) |
| ; MIPS32-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1 |
| ; MIPS32-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (load (s32) from %fixed-stack.1) |
| ; MIPS32-NEXT: [[FRAME_INDEX2:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.2 |
| ; MIPS32-NEXT: [[LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX2]](p0) :: (load (s32) from %fixed-stack.2, align 8) |
| ; MIPS32-NEXT: [[FRAME_INDEX3:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.3 |
| ; MIPS32-NEXT: [[LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX3]](p0) :: (load (s32) from %fixed-stack.3) |
| ; MIPS32-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[LOAD]], [[COPY]] |
| ; MIPS32-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[LOAD]](s32), [[COPY]] |
| ; MIPS32-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[LOAD1]], [[COPY1]] |
| ; MIPS32-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[SUB1]](s32), [[LOAD1]] |
| ; MIPS32-NEXT: [[SUB2:%[0-9]+]]:_(s32) = G_SUB [[SUB1]], [[ICMP]] |
| ; MIPS32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 |
| ; MIPS32-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[SUB1]](s32), [[C]] |
| ; MIPS32-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP2]], [[ICMP]] |
| ; MIPS32-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[ICMP1]], [[AND]] |
| ; MIPS32-NEXT: [[SUB3:%[0-9]+]]:_(s32) = G_SUB [[LOAD2]], [[COPY2]] |
| ; MIPS32-NEXT: [[ICMP3:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[SUB3]](s32), [[LOAD2]] |
| ; MIPS32-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; MIPS32-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[OR]], [[C1]] |
| ; MIPS32-NEXT: [[SUB4:%[0-9]+]]:_(s32) = G_SUB [[SUB3]], [[AND1]] |
| ; MIPS32-NEXT: [[ICMP4:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[SUB3]](s32), [[C]] |
| ; MIPS32-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[ICMP4]], [[OR]] |
| ; MIPS32-NEXT: [[OR1:%[0-9]+]]:_(s32) = G_OR [[ICMP3]], [[AND2]] |
| ; MIPS32-NEXT: [[SUB5:%[0-9]+]]:_(s32) = G_SUB [[LOAD3]], [[COPY3]] |
| ; MIPS32-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND [[OR1]], [[C1]] |
| ; MIPS32-NEXT: [[SUB6:%[0-9]+]]:_(s32) = G_SUB [[SUB5]], [[AND3]] |
| ; MIPS32-NEXT: $v0 = COPY [[SUB]](s32) |
| ; MIPS32-NEXT: $v1 = COPY [[SUB2]](s32) |
| ; MIPS32-NEXT: $a0 = COPY [[SUB4]](s32) |
| ; MIPS32-NEXT: $a1 = COPY [[SUB6]](s32) |
| ; MIPS32-NEXT: RetRA implicit $v0, implicit $v1, implicit $a0, implicit $a1 |
| %2:_(s32) = COPY $a0 |
| %3:_(s32) = COPY $a1 |
| %4:_(s32) = COPY $a2 |
| %5:_(s32) = COPY $a3 |
| %0:_(s128) = G_MERGE_VALUES %2(s32), %3(s32), %4(s32), %5(s32) |
| %10:_(p0) = G_FRAME_INDEX %fixed-stack.3 |
| %6:_(s32) = G_LOAD %10(p0) :: (load (s32) from %fixed-stack.3, align 8) |
| %11:_(p0) = G_FRAME_INDEX %fixed-stack.2 |
| %7:_(s32) = G_LOAD %11(p0) :: (load (s32) from %fixed-stack.2, align 4) |
| %12:_(p0) = G_FRAME_INDEX %fixed-stack.1 |
| %8:_(s32) = G_LOAD %12(p0) :: (load (s32) from %fixed-stack.1, align 8) |
| %13:_(p0) = G_FRAME_INDEX %fixed-stack.0 |
| %9:_(s32) = G_LOAD %13(p0) :: (load (s32) from %fixed-stack.0, align 4) |
| %1:_(s128) = G_MERGE_VALUES %6(s32), %7(s32), %8(s32), %9(s32) |
| %14:_(s128) = G_SUB %1, %0 |
| %15:_(s32), %16:_(s32), %17:_(s32), %18:_(s32) = G_UNMERGE_VALUES %14(s128) |
| $v0 = COPY %15(s32) |
| $v1 = COPY %16(s32) |
| $a0 = COPY %17(s32) |
| $a1 = COPY %18(s32) |
| RetRA implicit $v0, implicit $v1, implicit $a0, implicit $a1 |
| |
| ... |