# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3
# RUN: llc -mtriple=riscv64 -mattr='+zba' -run-pass=instruction-select -simplify-mir -verify-machineinstrs %s -o - \
# RUN: | FileCheck %s
---
name: sh1add
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11
; CHECK-LABEL: name: sh1add
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[SH1ADD:%[0-9]+]]:gpr = SH1ADD [[COPY]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[SH1ADD]]
%0:gprb(s64) = COPY $x10
%1:gprb(s64) = COPY $x11
%2:gprb(s64) = G_CONSTANT i64 1
%3:gprb(s64) = G_SHL %0, %2
%4:gprb(s64) = G_ADD %3, %1
$x10 = COPY %4(s64)
...
---
name: sh2add
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11
; CHECK-LABEL: name: sh2add
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[SH2ADD:%[0-9]+]]:gpr = SH2ADD [[COPY]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[SH2ADD]]
%0:gprb(s64) = COPY $x10
%1:gprb(s64) = COPY $x11
%2:gprb(s64) = G_CONSTANT i64 2
%3:gprb(s64) = G_SHL %0, %2
%4:gprb(s64) = G_ADD %3, %1
$x10 = COPY %4(s64)
...
---
name: sh3add
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11
; CHECK-LABEL: name: sh3add
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[SH3ADD:%[0-9]+]]:gpr = SH3ADD [[COPY]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[SH3ADD]]
%0:gprb(s64) = COPY $x10
%1:gprb(s64) = COPY $x11
%2:gprb(s64) = G_CONSTANT i64 3
%3:gprb(s64) = G_SHL %0, %2
%4:gprb(s64) = G_ADD %3, %1
$x10 = COPY %4(s64)
...
---
name: no_sh1add
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11
; CHECK-LABEL: name: no_sh1add
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[SLLI:%[0-9]+]]:gpr = SLLI [[COPY]], 1
; CHECK-NEXT: [[ADDI:%[0-9]+]]:gpr = ADDI [[SLLI]], 37
; CHECK-NEXT: $x10 = COPY [[ADDI]]
%0:gprb(s64) = COPY $x10
%1:gprb(s64) = G_CONSTANT i64 37
%2:gprb(s64) = G_CONSTANT i64 1
%3:gprb(s64) = G_SHL %0, %2
%4:gprb(s64) = G_ADD %3, %1
$x10 = COPY %4(s64)
...
---
name: shXadd_complex_and_shl
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11
; CHECK-LABEL: name: shXadd_complex_and_shl
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[SRLIW:%[0-9]+]]:gpr = SRLIW [[COPY]], 1
; CHECK-NEXT: [[SH3ADD:%[0-9]+]]:gpr = SH3ADD [[SRLIW]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[SH3ADD]]
%0:gprb(s64) = COPY $x10
%1:gprb(s64) = COPY $x11
%2:gprb(s64) = G_CONSTANT i64 4294967294
%3:gprb(s64) = G_AND %0, %2
%4:gprb(s64) = G_CONSTANT i64 2
%5:gprb(s64) = G_SHL %3, %4
%6:gprb(s64) = G_ADD %5, %1
$x10 = COPY %6(s64)
...
---
name: shXadd_complex_and_lshr
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11
; CHECK-LABEL: name: shXadd_complex_and_lshr
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[SRLIW:%[0-9]+]]:gpr = SRLIW [[COPY]], 2
; CHECK-NEXT: [[SH1ADD:%[0-9]+]]:gpr = SH1ADD [[SRLIW]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[SH1ADD]]
%0:gprb(s64) = COPY $x10
%1:gprb(s64) = COPY $x11
%2:gprb(s64) = G_CONSTANT i64 4294967292
%3:gprb(s64) = G_AND %0, %2
%4:gprb(s64) = G_CONSTANT i64 1
%5:gprb(s64) = G_LSHR %3, %4
%6:gprb(s64) = G_ADD %5, %1
$x10 = COPY %6(s64)
...
---
name: shXadd_uw_complex_shl_and
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11
; CHECK-LABEL: name: shXadd_uw_complex_shl_and
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[SLLI:%[0-9]+]]:gpr = SLLI [[COPY]], 1
; CHECK-NEXT: [[SH2ADD_UW:%[0-9]+]]:gpr = SH2ADD_UW [[SLLI]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[SH2ADD_UW]]
%0:gprb(s64) = COPY $x10
%1:gprb(s64) = COPY $x11
%2:gprb(s64) = G_CONSTANT i64 3
%3:gprb(s64) = G_SHL %0, %2
%4:gprb(s64) = G_CONSTANT i64 17179869183
%5:gprb(s64) = G_AND %3, %4
%6:gprb(s64) = G_ADD %5, %1
$x10 = COPY %6(s64)
...
---
name: slli_uw
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10
; CHECK-LABEL: name: slli_uw
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[SLLI_UW:%[0-9]+]]:gpr = SLLI_UW [[COPY]], 7
; CHECK-NEXT: $x10 = COPY [[SLLI_UW]]
%0:gprb(s64) = COPY $x10
%1:gprb(s64) = G_CONSTANT i64 4294967295
%2:gprb(s64) = G_AND %0, %1
%3:gprb(s64) = G_CONSTANT i64 7
%4:gprb(s64) = G_SHL %2, %3
$x10 = COPY %4(s64)
...
---
name: slli_uw_s32
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10
; CHECK-LABEL: name: slli_uw_s32
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[SLLI_UW:%[0-9]+]]:gpr = SLLI_UW [[COPY]], 7
; CHECK-NEXT: $x10 = COPY [[SLLI_UW]]
%0:gprb(s64) = COPY $x10
%1:gprb(s32) = G_TRUNC %0(s64)
%2:gprb(s64) = G_ZEXT %1(s32)
%3:gprb(s64) = G_CONSTANT i64 7
%4:gprb(s64) = G_SHL %2, %3
$x10 = COPY %4(s64)
...
---
name: slli_uw_complex
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10
; CHECK-LABEL: name: slli_uw_complex
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[SRLI:%[0-9]+]]:gpr = SRLI [[COPY]], 2
; CHECK-NEXT: [[SLLI_UW:%[0-9]+]]:gpr = SLLI_UW [[SRLI]], 2
; CHECK-NEXT: $x10 = COPY [[SLLI_UW]]
%0:gprb(s64) = COPY $x10
%1:gprb(s64) = G_CONSTANT i64 17179869180
%2:gprb(s64) = G_AND %0, %1
$x10 = COPY %2(s64)
...
---
name: sh1add_s32
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11
; CHECK-LABEL: name: sh1add_s32
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[SH1ADD:%[0-9]+]]:gpr = SH1ADD [[COPY]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[SH1ADD]]
%0:gprb(s64) = COPY $x10
%1:gprb(s64) = COPY $x11
%2:gprb(s32) = G_TRUNC %0
%3:gprb(s32) = G_TRUNC %1
%4:gprb(s64) = G_CONSTANT i64 1
%5:gprb(s32) = G_SHL %2, %4
%6:gprb(s32) = G_ADD %5, %3
%7:gprb(s64) = G_ANYEXT %6
$x10 = COPY %7(s64)
...
---
name: sh2add_s32
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11
; CHECK-LABEL: name: sh2add_s32
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[SH2ADD:%[0-9]+]]:gpr = SH2ADD [[COPY]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[SH2ADD]]
%0:gprb(s64) = COPY $x10
%1:gprb(s64) = COPY $x11
%2:gprb(s32) = G_TRUNC %0
%3:gprb(s32) = G_TRUNC %1
%4:gprb(s64) = G_CONSTANT i64 2
%5:gprb(s32) = G_SHL %2, %4
%6:gprb(s32) = G_ADD %5, %3
%7:gprb(s64) = G_ANYEXT %6
$x10 = COPY %7(s64)
...
---
name: sh3add_s32
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11
; CHECK-LABEL: name: sh3add_s32
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[SH3ADD:%[0-9]+]]:gpr = SH3ADD [[COPY]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[SH3ADD]]
%0:gprb(s64) = COPY $x10
%1:gprb(s64) = COPY $x11
%2:gprb(s32) = G_TRUNC %0
%3:gprb(s32) = G_TRUNC %1
%4:gprb(s64) = G_CONSTANT i64 3
%5:gprb(s32) = G_SHL %2, %4
%6:gprb(s32) = G_ADD %5, %3
%7:gprb(s64) = G_ANYEXT %6
$x10 = COPY %7(s64)
...
---
name: adduw
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11
; CHECK-LABEL: name: adduw
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[ADD_UW:%[0-9]+]]:gpr = ADD_UW [[COPY]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[ADD_UW]]
%0:gprb(s64) = COPY $x10
%1:gprb(s64) = COPY $x11
%2:gprb(s32) = G_TRUNC %0
%3:gprb(s64) = G_ZEXT %2
%4:gprb(s64) = G_ADD %3, %1
$x10 = COPY %4(s64)
...