Compiler projects using llvm
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=aarch64-- -verify-machineinstrs -run-pass=legalizer %s -o - | FileCheck %s
---
name:            test_udivrem_64
body:             |
  bb.0.entry:
    ; CHECK-LABEL: name: test_udivrem_64
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
    ; CHECK: [[UDIV:%[0-9]+]]:_(s64) = G_UDIV [[COPY]], [[COPY1]]
    ; CHECK: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[UDIV]], [[COPY1]]
    ; CHECK: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[MUL]]
    ; CHECK: $x0 = COPY [[UDIV]](s64)
    ; CHECK: $x1 = COPY [[SUB]](s64)
    %0:_(s64) = COPY $x0
    %1:_(s64) = COPY $x1
    %2:_(s64), %3:_(s64) = G_UDIVREM %0, %1
    $x0 = COPY %2(s64)
    $x1 = COPY %3(s64)

...
---
name:            test_sdivrem_32
body:             |
  bb.0.entry:
    ; CHECK-LABEL: name: test_sdivrem_32
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
    ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
    ; CHECK: [[SDIV:%[0-9]+]]:_(s32) = G_SDIV [[TRUNC]], [[TRUNC1]]
    ; CHECK: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[SDIV]], [[TRUNC1]]
    ; CHECK: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[TRUNC]], [[MUL]]
    ; CHECK: $w0 = COPY [[SDIV]](s32)
    ; CHECK: $w1 = COPY [[SUB]](s32)
    %0:_(s64) = COPY $x0
    %1:_(s64) = COPY $x1
    %2:_(s32) = G_TRUNC %0(s64)
    %3:_(s32) = G_TRUNC %1(s64)
    %4:_(s32), %5:_(s32) = G_SDIVREM %2, %3
    $w0 = COPY %4(s32)
    $w1 = COPY %5(s32)

...
---
name:            test_sdivrem_8
body:             |
  bb.0.entry:
    ; CHECK-LABEL: name: test_sdivrem_8
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
    ; CHECK: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[TRUNC]], 8
    ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
    ; CHECK: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[TRUNC1]], 8
    ; CHECK: [[SDIV:%[0-9]+]]:_(s32) = G_SDIV [[SEXT_INREG]], [[SEXT_INREG1]]
    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[TRUNC1]](s32)
    ; CHECK: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[SDIV]], [[COPY2]]
    ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[TRUNC]](s32)
    ; CHECK: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY3]], [[MUL]]
    ; CHECK: $w0 = COPY [[SDIV]](s32)
    ; CHECK: $w1 = COPY [[SUB]](s32)
    %0:_(s64) = COPY $x0
    %1:_(s64) = COPY $x1
    %2:_(s8) = G_TRUNC %0(s64)
    %3:_(s8) = G_TRUNC %1(s64)
    %4:_(s8), %5:_(s8) = G_SDIVREM %2, %3
    %6:_(s32) = G_ANYEXT %4(s8)
    %7:_(s32) = G_ANYEXT %5(s8)
    $w0 = COPY %6(s32)
    $w1 = COPY %7(s32)

...