xref: /llvm-project/llvm/test/CodeGen/X86/GlobalISel/legalize-trunc.mir (revision 373c343a77a7afaa07179db1754a52b620dfaf2e)
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -O0 -mtriple=i386-linux-gnu   -run-pass=legalizer %s -o - | FileCheck %s --check-prefix=X32
3# RUN: llc -O0 -mtriple=x86_64-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s --check-prefix=X64
4--- |
5  define void @trunc_check() {
6    ret void
7  }
8
9...
10---
11name:            trunc_check
12registers:
13  - { id: 0, class: _ }
14  - { id: 1, class: _ }
15  - { id: 2, class: _ }
16  - { id: 3, class: _ }
17body:             |
18  bb.1 (%ir-block.0):
19    ; X32-LABEL: name: trunc_check
20    ; X32: [[DEF:%[0-9]+]]:_(s32) = IMPLICIT_DEF
21    ; X32-NEXT: [[DEF1:%[0-9]+]]:_(p0) = G_IMPLICIT_DEF
22    ; X32-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[DEF]](s32)
23    ; X32-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
24    ; X32-NEXT: [[AND:%[0-9]+]]:_(s8) = G_AND [[TRUNC]], [[C]]
25    ; X32-NEXT: G_STORE [[AND]](s8), [[DEF1]](p0) :: (store (s1))
26    ; X32-NEXT: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[DEF]](s32)
27    ; X32-NEXT: G_STORE [[TRUNC1]](s8), [[DEF1]](p0) :: (store (s8))
28    ; X32-NEXT: [[TRUNC2:%[0-9]+]]:_(s16) = G_TRUNC [[DEF]](s32)
29    ; X32-NEXT: G_STORE [[TRUNC2]](s16), [[DEF1]](p0) :: (store (s16))
30    ; X32-NEXT: RET 0
31    ;
32    ; X64-LABEL: name: trunc_check
33    ; X64: [[DEF:%[0-9]+]]:_(s32) = IMPLICIT_DEF
34    ; X64-NEXT: [[DEF1:%[0-9]+]]:_(p0) = G_IMPLICIT_DEF
35    ; X64-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[DEF]](s32)
36    ; X64-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
37    ; X64-NEXT: [[AND:%[0-9]+]]:_(s8) = G_AND [[TRUNC]], [[C]]
38    ; X64-NEXT: G_STORE [[AND]](s8), [[DEF1]](p0) :: (store (s1))
39    ; X64-NEXT: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[DEF]](s32)
40    ; X64-NEXT: G_STORE [[TRUNC1]](s8), [[DEF1]](p0) :: (store (s8))
41    ; X64-NEXT: [[TRUNC2:%[0-9]+]]:_(s16) = G_TRUNC [[DEF]](s32)
42    ; X64-NEXT: G_STORE [[TRUNC2]](s16), [[DEF1]](p0) :: (store (s16))
43    ; X64-NEXT: RET 0
44    %0(s32) = IMPLICIT_DEF
45    %1(s1)  = G_TRUNC %0(s32)
46    %4:_(p0) = G_IMPLICIT_DEF
47    G_STORE %1, %4 :: (store (s1))
48
49    %2(s8)  = G_TRUNC %0(s32)
50    G_STORE %2, %4 :: (store (s8))
51
52    %3(s16) = G_TRUNC %0(s32)
53    G_STORE %3, %4 :: (store (s16))
54    RET 0
55
56...
57