llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/legalize-ext.mir

367 lines
11 KiB
YAML

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -O0 -march=aarch64 -run-pass=legalizer %s -o - | FileCheck %s
---
name: test_ext
body: |
bb.0.entry:
; CHECK-LABEL: name: test_ext
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK: $w0 = COPY [[TRUNC]](s32)
; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK: $w0 = COPY [[TRUNC1]](s32)
; CHECK: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK: $w0 = COPY [[TRUNC2]](s32)
; CHECK: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK: $w0 = COPY [[TRUNC3]](s32)
; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
; CHECK: $x0 = COPY [[COPY1]](s64)
; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
; CHECK: $x0 = COPY [[AND]](s64)
; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
; CHECK: $x0 = COPY [[COPY3]](s64)
; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 32
; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY4]], [[C1]]
; CHECK: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C1]]
; CHECK: $x0 = COPY [[ASHR]](s64)
; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
; CHECK: [[TRUNC4:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[TRUNC4]], [[C2]]
; CHECK: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C2]]
; CHECK: $w0 = COPY [[ASHR1]](s32)
; CHECK: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
; CHECK: [[TRUNC5:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[TRUNC5]], [[C3]]
; CHECK: $w0 = COPY [[AND1]](s32)
; CHECK: [[TRUNC6:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK: $w0 = COPY [[TRUNC6]](s32)
; CHECK: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; CHECK: [[TRUNC7:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK: [[AND2:%[0-9]+]]:_(s32) = G_AND [[TRUNC7]], [[C4]]
; CHECK: $w0 = COPY [[AND2]](s32)
; CHECK: [[TRUNC8:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK: $w0 = COPY [[TRUNC8]](s32)
; CHECK: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
; CHECK: [[TRUNC9:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[TRUNC9]], [[C5]]
; CHECK: [[ASHR2:%[0-9]+]]:_(s32) = G_ASHR [[SHL2]], [[C5]]
; CHECK: $w0 = COPY [[ASHR2]](s32)
; CHECK: [[TRUNC10:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK: [[AND3:%[0-9]+]]:_(s32) = G_AND [[TRUNC10]], [[C4]]
; CHECK: $w0 = COPY [[AND3]](s32)
; CHECK: [[TRUNC11:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK: $w0 = COPY [[TRUNC11]](s32)
; CHECK: [[TRUNC12:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK: $w0 = COPY [[TRUNC12]](s32)
; CHECK: [[FPEXT:%[0-9]+]]:_(s64) = G_FPEXT [[TRUNC12]](s32)
; CHECK: $x0 = COPY [[FPEXT]](s64)
; CHECK: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
; CHECK: $w0 = COPY [[C7]](s32)
; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: $w0 = COPY [[DEF]](s32)
%0:_(s64) = COPY $x0
%1:_(s1) = G_TRUNC %0(s64)
%19:_(s32) = G_ANYEXT %1(s1)
$w0 = COPY %19(s32)
%2:_(s8) = G_TRUNC %0(s64)
%20:_(s32) = G_ANYEXT %2(s8)
$w0 = COPY %20(s32)
%3:_(s16) = G_TRUNC %0(s64)
%21:_(s32) = G_ANYEXT %3(s16)
$w0 = COPY %21(s32)
%4:_(s32) = G_TRUNC %0(s64)
$w0 = COPY %4(s32)
%5:_(s64) = G_ANYEXT %1(s1)
$x0 = COPY %5(s64)
%6:_(s64) = G_ZEXT %2(s8)
$x0 = COPY %6(s64)
%7:_(s64) = G_ANYEXT %3(s16)
$x0 = COPY %7(s64)
%8:_(s64) = G_SEXT %4(s32)
$x0 = COPY %8(s64)
%9:_(s32) = G_SEXT %1(s1)
$w0 = COPY %9(s32)
%10:_(s32) = G_ZEXT %2(s8)
$w0 = COPY %10(s32)
%11:_(s32) = G_ANYEXT %3(s16)
$w0 = COPY %11(s32)
%12:_(s32) = G_ZEXT %1(s1)
$w0 = COPY %12(s32)
%13:_(s32) = G_ANYEXT %2(s8)
$w0 = COPY %13(s32)
%14:_(s32) = G_SEXT %3(s16)
$w0 = COPY %14(s32)
%15:_(s8) = G_ZEXT %1(s1)
%22:_(s32) = G_ANYEXT %15(s8)
$w0 = COPY %22(s32)
%16:_(s16) = G_ANYEXT %2(s8)
%23:_(s32) = G_ANYEXT %16(s16)
$w0 = COPY %23(s32)
%17:_(s32) = G_TRUNC %0(s64)
$w0 = COPY %17(s32)
%18:_(s64) = G_FPEXT %17(s32)
$x0 = COPY %18(s64)
%24:_(s16) = G_IMPLICIT_DEF
%25:_(s32) = G_ZEXT %24(s16)
$w0 = COPY %25(s32)
%26:_(s32) = G_SEXT %24(s16)
$w0 = COPY %26(s32)
%27:_(s32) = G_ANYEXT %24(s16)
$w0 = COPY %27(s32)
...
---
name: test_anyext_anyext
body: |
bb.0:
liveins: $w0
; CHECK-LABEL: name: test_anyext_anyext
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
; CHECK: $w0 = COPY [[COPY1]](s32)
%0:_(s32) = COPY $w0
%1:_(s1) = G_TRUNC %0(s32)
%2:_(s8) = G_ANYEXT %1(s1)
%3:_(s32) = G_ANYEXT %2(s8)
$w0 = COPY %3(s32)
...
---
name: test_anyext_sext
body: |
bb.0:
liveins: $w0
; CHECK-LABEL: name: test_anyext_sext
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[C]]
; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]]
; CHECK: $w0 = COPY [[ASHR]](s32)
%0:_(s32) = COPY $w0
%1:_(s1) = G_TRUNC %0(s32)
%2:_(s8) = G_SEXT %1(s1)
%3:_(s32) = G_ANYEXT %2(s8)
$w0 = COPY %3(s32)
...
---
name: test_anyext_zext
body: |
bb.0:
liveins: $w0
; CHECK-LABEL: name: test_anyext_zext
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
; CHECK: $w0 = COPY [[AND]](s32)
%0:_(s32) = COPY $w0
%1:_(s1) = G_TRUNC %0(s32)
%2:_(s8) = G_ZEXT %1(s1)
%3:_(s32) = G_ANYEXT %2(s8)
$w0 = COPY %3(s32)
...
---
name: test_zext_v8s16_from_v8s8
alignment: 2
tracksRegLiveness: true
machineFunctionInfo: {}
body: |
bb.0:
liveins: $d0
; CHECK-LABEL: name: test_zext_v8s16_from_v8s8
; CHECK: liveins: $d0
; CHECK: [[COPY:%[0-9]+]]:fpr(<8 x s8>) = COPY $d0
; CHECK: [[ZEXT:%[0-9]+]]:_(<8 x s16>) = G_ZEXT [[COPY]](<8 x s8>)
; CHECK: $q0 = COPY [[ZEXT]](<8 x s16>)
; CHECK: RET_ReallyLR implicit $q0
%1:fpr(<8 x s8>) = COPY $d0
%2:_(<8 x s16>) = G_ZEXT %1(<8 x s8>)
$q0 = COPY %2(<8 x s16>)
RET_ReallyLR implicit $q0
...
---
name: test_sext_v8s16_from_v8s8
alignment: 2
tracksRegLiveness: true
machineFunctionInfo: {}
body: |
bb.0:
liveins: $d0
; CHECK-LABEL: name: test_sext_v8s16_from_v8s8
; CHECK: liveins: $d0
; CHECK: [[COPY:%[0-9]+]]:fpr(<8 x s8>) = COPY $d0
; CHECK: [[SEXT:%[0-9]+]]:_(<8 x s16>) = G_SEXT [[COPY]](<8 x s8>)
; CHECK: $q0 = COPY [[SEXT]](<8 x s16>)
; CHECK: RET_ReallyLR implicit $q0
%1:fpr(<8 x s8>) = COPY $d0
%2:_(<8 x s16>) = G_SEXT %1(<8 x s8>)
$q0 = COPY %2(<8 x s16>)
RET_ReallyLR implicit $q0
...
---
name: test_anyext_v8s16_from_v8s8
alignment: 2
tracksRegLiveness: true
machineFunctionInfo: {}
body: |
bb.0:
liveins: $d0
; CHECK-LABEL: name: test_anyext_v8s16_from_v8s8
; CHECK: liveins: $d0
; CHECK: [[COPY:%[0-9]+]]:fpr(<8 x s8>) = COPY $d0
; CHECK: [[ANYEXT:%[0-9]+]]:_(<8 x s16>) = G_ANYEXT [[COPY]](<8 x s8>)
; CHECK: $q0 = COPY [[ANYEXT]](<8 x s16>)
; CHECK: RET_ReallyLR implicit $q0
%1:fpr(<8 x s8>) = COPY $d0
%2:_(<8 x s16>) = G_ANYEXT %1(<8 x s8>)
$q0 = COPY %2(<8 x s16>)
RET_ReallyLR implicit $q0
...
---
name: test_zext_v4s32_from_v4s16
alignment: 2
tracksRegLiveness: true
machineFunctionInfo: {}
body: |
bb.0:
liveins: $d0
; CHECK-LABEL: name: test_zext_v4s32_from_v4s16
; CHECK: liveins: $d0
; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
; CHECK: [[ZEXT:%[0-9]+]]:_(<4 x s32>) = G_ZEXT [[COPY]](<4 x s16>)
; CHECK: $q0 = COPY [[ZEXT]](<4 x s32>)
; CHECK: RET_ReallyLR implicit $q0
%0:_(<4 x s16>) = COPY $d0
%1:_(<4 x s32>) = G_ZEXT %0(<4 x s16>)
$q0 = COPY %1(<4 x s32>)
RET_ReallyLR implicit $q0
...
---
name: test_sext_v4s32_from_v4s16
alignment: 2
tracksRegLiveness: true
machineFunctionInfo: {}
body: |
bb.0:
liveins: $d0
; CHECK-LABEL: name: test_sext_v4s32_from_v4s16
; CHECK: liveins: $d0
; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
; CHECK: [[SEXT:%[0-9]+]]:_(<4 x s32>) = G_SEXT [[COPY]](<4 x s16>)
; CHECK: $q0 = COPY [[SEXT]](<4 x s32>)
; CHECK: RET_ReallyLR implicit $q0
%0:_(<4 x s16>) = COPY $d0
%1:_(<4 x s32>) = G_SEXT %0(<4 x s16>)
$q0 = COPY %1(<4 x s32>)
RET_ReallyLR implicit $q0
...
---
name: test_anyext_v4s32_from_v4s16
alignment: 2
tracksRegLiveness: true
machineFunctionInfo: {}
body: |
bb.0:
liveins: $d0
; CHECK-LABEL: name: test_anyext_v4s32_from_v4s16
; CHECK: liveins: $d0
; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
; CHECK: [[ANYEXT:%[0-9]+]]:_(<4 x s32>) = G_ANYEXT [[COPY]](<4 x s16>)
; CHECK: $q0 = COPY [[ANYEXT]](<4 x s32>)
; CHECK: RET_ReallyLR implicit $q0
%0:_(<4 x s16>) = COPY $d0
%1:_(<4 x s32>) = G_ANYEXT %0(<4 x s16>)
$q0 = COPY %1(<4 x s32>)
RET_ReallyLR implicit $q0
...
---
name: test_zext_v2s64_from_v2s32
alignment: 2
tracksRegLiveness: true
registers:
- { id: 0, class: _ }
- { id: 1, class: _ }
machineFunctionInfo: {}
body: |
bb.0:
liveins: $d0
; CHECK-LABEL: name: test_zext_v2s64_from_v2s32
; CHECK: liveins: $d0
; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
; CHECK: [[ZEXT:%[0-9]+]]:_(<2 x s64>) = G_ZEXT [[COPY]](<2 x s32>)
; CHECK: $q0 = COPY [[ZEXT]](<2 x s64>)
; CHECK: RET_ReallyLR implicit $q0
%0:_(<2 x s32>) = COPY $d0
%1:_(<2 x s64>) = G_ZEXT %0(<2 x s32>)
$q0 = COPY %1(<2 x s64>)
RET_ReallyLR implicit $q0
...
---
name: test_sext_v2s64_from_v2s32
alignment: 2
tracksRegLiveness: true
registers:
- { id: 0, class: _ }
- { id: 1, class: _ }
machineFunctionInfo: {}
body: |
bb.0:
liveins: $d0
; CHECK-LABEL: name: test_sext_v2s64_from_v2s32
; CHECK: liveins: $d0
; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
; CHECK: [[SEXT:%[0-9]+]]:_(<2 x s64>) = G_SEXT [[COPY]](<2 x s32>)
; CHECK: $q0 = COPY [[SEXT]](<2 x s64>)
; CHECK: RET_ReallyLR implicit $q0
%0:_(<2 x s32>) = COPY $d0
%1:_(<2 x s64>) = G_SEXT %0(<2 x s32>)
$q0 = COPY %1(<2 x s64>)
RET_ReallyLR implicit $q0
...
---
name: test_anyext_v2s64_from_v2s32
alignment: 2
tracksRegLiveness: true
registers:
- { id: 0, class: _ }
- { id: 1, class: _ }
machineFunctionInfo: {}
body: |
bb.0:
liveins: $d0
; CHECK-LABEL: name: test_anyext_v2s64_from_v2s32
; CHECK: liveins: $d0
; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
; CHECK: [[ANYEXT:%[0-9]+]]:_(<2 x s64>) = G_ANYEXT [[COPY]](<2 x s32>)
; CHECK: $q0 = COPY [[ANYEXT]](<2 x s64>)
; CHECK: RET_ReallyLR implicit $q0
%0:_(<2 x s32>) = COPY $d0
%1:_(<2 x s64>) = G_ANYEXT %0(<2 x s32>)
$q0 = COPY %1(<2 x s64>)
RET_ReallyLR implicit $q0
...