# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
# RUN: llc -mtriple=riscv32 -mattr=+v -run-pass=legalizer %s -o - | FileCheck %s
---
name: constbarrier_i32
body: |
bb.0.entry:
; CHECK-LABEL: name: constbarrier_i32
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16368
; CHECK-NEXT: [[CONSTANT_FOLD_BARRIER:%[0-9]+]]:_(s32) = G_CONSTANT_FOLD_BARRIER [[C]]
; CHECK-NEXT: $x10 = COPY [[CONSTANT_FOLD_BARRIER]](s32)
; CHECK-NEXT: PseudoRET implicit $x10
%1:_(s32) = G_CONSTANT i32 16368
%2:_(s32) = G_CONSTANT_FOLD_BARRIER %1
$x10 = COPY %2(s32)
PseudoRET implicit $x10
...
---
name: constbarrier_i16
body: |
bb.0.entry:
; CHECK-LABEL: name: constbarrier_i16
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2048
; CHECK-NEXT: [[CONSTANT_FOLD_BARRIER:%[0-9]+]]:_(s32) = G_CONSTANT_FOLD_BARRIER [[C]]
; CHECK-NEXT: $x10 = COPY [[CONSTANT_FOLD_BARRIER]](s32)
; CHECK-NEXT: PseudoRET implicit $x10
%1:_(s16) = G_CONSTANT i16 2048
%2:_(s16) = G_CONSTANT_FOLD_BARRIER %1
%3:_(s32) = G_ANYEXT %2(s16)
$x10 = COPY %3(s32)
PseudoRET implicit $x10
...
---
name: constbarrier_i128
body: |
bb.0.entry:
; CHECK-LABEL: name: constbarrier_i128
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2048
; CHECK-NEXT: [[CONSTANT_FOLD_BARRIER:%[0-9]+]]:_(s32) = G_CONSTANT_FOLD_BARRIER [[C]]
; CHECK-NEXT: $x10 = COPY [[CONSTANT_FOLD_BARRIER]](s32)
; CHECK-NEXT: PseudoRET implicit $x10
%1:_(s128) = G_CONSTANT i128 2048
%2:_(s128) = G_CONSTANT_FOLD_BARRIER %1
%3:_(s32) = G_TRUNC %2(s128)
$x10 = COPY %3(s32)
PseudoRET implicit $x10
...
---
name: constbarrier_nxv2i1
body: |
bb.0.entry:
; CHECK-LABEL: name: constbarrier_nxv2i1
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
; CHECK-NEXT: [[VMSET_VL:%[0-9]+]]:_(<vscale x 2 x s1>) = G_VMSET_VL [[C]](s32)
; CHECK-NEXT: [[VMCLR_VL:%[0-9]+]]:_(<vscale x 2 x s1>) = G_VMCLR_VL [[C]](s32)
; CHECK-NEXT: [[CONSTANT_FOLD_BARRIER:%[0-9]+]]:_(<vscale x 2 x s1>) = G_CONSTANT_FOLD_BARRIER [[VMCLR_VL]]
; CHECK-NEXT: $v8 = COPY [[CONSTANT_FOLD_BARRIER]](<vscale x 2 x s1>)
; CHECK-NEXT: PseudoRET implicit $v8
%1:_(s1) = G_CONSTANT i1 0
%2:_(<vscale x 2 x s1>) = G_SPLAT_VECTOR %1(s1)
%3:_(<vscale x 2 x s1>) = G_CONSTANT_FOLD_BARRIER %2
$v8 = COPY %3(<vscale x 2 x s1>)
PseudoRET implicit $v8
...
---
name: constbarrier_nxv2i32
body: |
bb.0.entry:
; CHECK-LABEL: name: constbarrier_nxv2i32
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
; CHECK-NEXT: [[SPLAT_VECTOR:%[0-9]+]]:_(<vscale x 2 x s32>) = G_SPLAT_VECTOR [[C]](s32)
; CHECK-NEXT: [[CONSTANT_FOLD_BARRIER:%[0-9]+]]:_(<vscale x 2 x s32>) = G_CONSTANT_FOLD_BARRIER [[SPLAT_VECTOR]]
; CHECK-NEXT: $v8 = COPY [[CONSTANT_FOLD_BARRIER]](<vscale x 2 x s32>)
; CHECK-NEXT: PseudoRET implicit $v8
%1:_(s32) = G_CONSTANT i32 0
%2:_(<vscale x 2 x s32>) = G_SPLAT_VECTOR %1(s32)
%3:_(<vscale x 2 x s32>) = G_CONSTANT_FOLD_BARRIER %2
$v8 = COPY %3(<vscale x 2 x s32>)
PseudoRET implicit $v8
...