# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=riscv64 -mattr=+d -run-pass=legalizer %s -o - \
# RUN: | FileCheck %s
---
name: test_simple_alloca
body: |
bb.1:
liveins: $x10
; CHECK-LABEL: name: test_simple_alloca
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295
; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 15
; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = nuw G_ADD [[AND]], [[C1]]
; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 -16
; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[ADD]], [[C2]]
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x2
; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY1]](p0)
; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[PTRTOINT]], [[AND1]]
; CHECK-NEXT: [[INTTOPTR:%[0-9]+]]:_(p0) = G_INTTOPTR [[SUB]](s64)
; CHECK-NEXT: $x2 = COPY [[INTTOPTR]](p0)
; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY [[INTTOPTR]](p0)
; CHECK-NEXT: $x10 = COPY [[COPY2]](p0)
; CHECK-NEXT: PseudoRET implicit $x10
%1:_(s64) = COPY $x10
%0:_(s32) = G_TRUNC %1(s64)
%2:_(s64) = G_ZEXT %0(s32)
%5:_(s64) = G_CONSTANT i64 15
%6:_(s64) = nuw G_ADD %2, %5
%7:_(s64) = G_CONSTANT i64 -16
%8:_(s64) = G_AND %6, %7
%9:_(p0) = G_DYN_STACKALLOC %8(s64), 1
$x10 = COPY %9(p0)
PseudoRET implicit $x10
...