llvm/llvm/test/CodeGen/X86/GlobalISel/legalize-constant-fold.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
# RUN: llc -mtriple=i386-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s --check-prefix=X86-32

# test constant fold barrier

...
---
name:            test_fold64
body:             |
  bb.0:
    ; X86-32-LABEL: name: test_fold64
    ; X86-32: [[DEF:%[0-9]+]]:_(s64) = IMPLICIT_DEF
    ; X86-32-NEXT: [[CONSTANT_FOLD_BARRIER:%[0-9]+]]:_(s64) = G_CONSTANT_FOLD_BARRIER [[DEF]]
    ; X86-32-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY [[CONSTANT_FOLD_BARRIER]](s64)
    ; X86-32-NEXT: RET 0, implicit [[COPY]](s64)
    %0:_(s64) = IMPLICIT_DEF
    %1:_(s64) = G_CONSTANT_FOLD_BARRIER %0
    %2:_(s64) = COPY %1(s64)
    RET 0, implicit %2

...
---
name:            test_fold32
body:             |
  bb.0:
    ; X86-32-LABEL: name: test_fold32
    ; X86-32: [[DEF:%[0-9]+]]:_(s32) = IMPLICIT_DEF
    ; X86-32-NEXT: [[CONSTANT_FOLD_BARRIER:%[0-9]+]]:_(s32) = G_CONSTANT_FOLD_BARRIER [[DEF]]
    ; X86-32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY [[CONSTANT_FOLD_BARRIER]](s32)
    ; X86-32-NEXT: RET 0, implicit [[COPY]](s32)
    %0:_(s32) = IMPLICIT_DEF
    %1:_(s32) = G_CONSTANT_FOLD_BARRIER %0
    %2:_(s32) = COPY %1(s32)
    RET 0, implicit %2

...
---
name:            test_fold16
body:             |
  bb.0:
    ; X86-32-LABEL: name: test_fold16
    ; X86-32: [[DEF:%[0-9]+]]:_(s16) = IMPLICIT_DEF
    ; X86-32-NEXT: [[CONSTANT_FOLD_BARRIER:%[0-9]+]]:_(s16) = G_CONSTANT_FOLD_BARRIER [[DEF]]
    ; X86-32-NEXT: [[COPY:%[0-9]+]]:_(s16) = COPY [[CONSTANT_FOLD_BARRIER]](s16)
    ; X86-32-NEXT: RET 0, implicit [[COPY]](s16)
    %0:_(s16) = IMPLICIT_DEF
    %1:_(s16) = G_CONSTANT_FOLD_BARRIER %0
    %2:_(s16) = COPY %1(s16)
    RET 0, implicit %2

...
---
name:            test_fold8
body:             |
  bb.0:
    ; X86-32-LABEL: name: test_fold8
    ; X86-32: [[DEF:%[0-9]+]]:_(s8) = IMPLICIT_DEF
    ; X86-32-NEXT: [[CONSTANT_FOLD_BARRIER:%[0-9]+]]:_(s8) = G_CONSTANT_FOLD_BARRIER [[DEF]]
    ; X86-32-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY [[CONSTANT_FOLD_BARRIER]](s8)
    ; X86-32-NEXT: RET 0, implicit [[COPY]](s8)
    %0:_(s8) = IMPLICIT_DEF
    %1:_(s8) = G_CONSTANT_FOLD_BARRIER %0
    %2:_(s8) = COPY %1(s8)
    RET 0, implicit %2

...