# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=riscv64 -run-pass=legalizer %s -o - \
# RUN: | FileCheck %s
---
name: const_i8
body: |
bb.0.entry:
; CHECK-LABEL: name: const_i8
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -127
; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32)
; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
; CHECK-NEXT: PseudoRET implicit $x10
%0:_(s8) = G_CONSTANT i8 129
%1:_(s64) = G_ANYEXT %0(s8)
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: const_i15
body: |
bb.0.entry:
; CHECK-LABEL: name: const_i15
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 15
; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32)
; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
; CHECK-NEXT: PseudoRET implicit $x10
%0:_(s15) = G_CONSTANT i15 15
%1:_(s64) = G_ANYEXT %0(s15)
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: const_i16
body: |
bb.0.entry:
; CHECK-LABEL: name: const_i16
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 767
; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32)
; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
; CHECK-NEXT: PseudoRET implicit $x10
%0:_(s16) = G_CONSTANT i16 -64769
%1:_(s64) = G_ANYEXT %0(s16)
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: const_i32
body: |
bb.0.entry:
; CHECK-LABEL: name: const_i32
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -64769
; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32)
; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
; CHECK-NEXT: PseudoRET implicit $x10
%0:_(s32) = G_CONSTANT i32 -64769
%1:_(s64) = G_ANYEXT %0(s32)
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: const_i64
body: |
bb.0.entry:
; CHECK-LABEL: name: const_i64
; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 2147483649
; CHECK-NEXT: $x10 = COPY [[C]](s64)
; CHECK-NEXT: PseudoRET implicit $x10
%0:_(s64) = G_CONSTANT i64 2147483649
$x10 = COPY %0(s64)
PseudoRET implicit $x10
...
---
name: const_i72
body: |
bb.0.entry:
; CHECK-LABEL: name: const_i72
; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -2147483649312
; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
; CHECK-NEXT: $x10 = COPY [[C]](s64)
; CHECK-NEXT: $x11 = COPY [[C1]](s64)
; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
%0:_(s72) = G_CONSTANT i72 -2147483649312
%1:_(s128) = G_ANYEXT %0(s72)
%2:_(s64), %3:_(s64) = G_UNMERGE_VALUES %1(s128)
$x10 = COPY %2(s64)
$x11 = COPY %3(s64)
PseudoRET implicit $x10, implicit $x11
...
---
name: const_i128
body: |
bb.0.entry:
; CHECK-LABEL: name: const_i128
; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 21474831289
; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
; CHECK-NEXT: $x10 = COPY [[C]](s64)
; CHECK-NEXT: $x11 = COPY [[C1]](s64)
; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
%0:_(s128) = G_CONSTANT i128 21474831289
%1:_(s64), %2:_(s64) = G_UNMERGE_VALUES %0(s128)
$x10 = COPY %1(s64)
$x11 = COPY %2(s64)
PseudoRET implicit $x10, implicit $x11
...
---
name: const_i192
body: |
bb.0.entry:
; CHECK-LABEL: name: const_i192
; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -214772364921
; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
; CHECK-NEXT: $x10 = COPY [[C]](s64)
; CHECK-NEXT: $x11 = COPY [[C1]](s64)
; CHECK-NEXT: $x12 = COPY [[C1]](s64)
; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12
%0:_(s192) = G_CONSTANT i192 -214772364921
%1:_(s64), %2:_(s64), %3:_(s64) = G_UNMERGE_VALUES %0(s192)
$x10 = COPY %1(s64)
$x11 = COPY %2(s64)
$x12 = COPY %3(s64)
PseudoRET implicit $x10, implicit $x11, implicit $x12
...
---
name: const_null
body: |
bb.0.entry:
; CHECK-LABEL: name: const_null
; CHECK: [[C:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
; CHECK-NEXT: $x10 = COPY [[C]](p0)
; CHECK-NEXT: PseudoRET implicit $x10
%0:_(p0) = G_CONSTANT i64 0
$x10 = COPY %0(p0)
PseudoRET implicit $x10
...
---
name: const_add_i32
body: |
bb.0.entry:
; CHECK-LABEL: name: const_add_i32
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -64769
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[TRUNC]], [[C]]
; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[ADD]](s32)
; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
; CHECK-NEXT: PseudoRET implicit $x10
%0:_(s32) = G_CONSTANT i32 -64769
%1:_(s64) = COPY $x10
%2:_(s32) = G_TRUNC %1(s64)
%3:_(s32) = G_ADD %2, %0
%4:_(s64) = G_ANYEXT %3(s32)
$x10 = COPY %4(s64)
PseudoRET implicit $x10
...
---
name: const_add_i8
body: |
bb.0.entry:
; CHECK-LABEL: name: const_add_i8
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[TRUNC]], [[C]]
; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[ADD]](s32)
; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
; CHECK-NEXT: PseudoRET implicit $x10
%0:_(s8) = G_CONSTANT i8 1
%1:_(s64) = COPY $x10
%2:_(s8) = G_TRUNC %1(s64)
%3:_(s8) = G_ADD %2, %0
%4:_(s64) = G_ANYEXT %3(s8)
$x10 = COPY %4(s64)
PseudoRET implicit $x10
...
...
---
name: constant_pool_i64
body: |
bb.0.entry:
; CHECK-LABEL: name: constant_pool_i64
; CHECK: [[CONSTANT_POOL:%[0-9]+]]:_(p0) = G_CONSTANT_POOL %const.0
; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[CONSTANT_POOL]](p0) :: (load (s64) from constant-pool)
; CHECK-NEXT: $x10 = COPY [[LOAD]](s64)
; CHECK-NEXT: PseudoRET implicit $x10
%0:_(s64) = G_CONSTANT i64 -1085102592571150096
$x10 = COPY %0(s64)
PseudoRET implicit $x10
...