xref: /llvm-project/llvm/test/CodeGen/X86/GlobalISel/legalize-fptrunc-scalar.mir (revision 48904e9452de81375bd55d830d08e51cc8f2ec7e)
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=x86_64-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s --check-prefix=ALL
3--- |
4
5  define float @test_fptrunc(double %in) {
6    %res = fptrunc double %in to float
7    ret float %res
8  }
9
10...
11---
12name:            test_fptrunc
13alignment:       16
14tracksRegLiveness: true
15registers:
16  - { id: 0, class: _ }
17  - { id: 1, class: _ }
18  - { id: 2, class: _ }
19  - { id: 3, class: _ }
20body:             |
21  bb.1 (%ir-block.0):
22    liveins: $xmm0
23
24    ; ALL-LABEL: name: test_fptrunc
25    ; ALL: liveins: $xmm0
26    ; ALL: [[COPY:%[0-9]+]]:_(s128) = COPY $xmm0
27    ; ALL: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY]](s128)
28    ; ALL: [[FPTRUNC:%[0-9]+]]:_(s32) = G_FPTRUNC [[TRUNC]](s64)
29    ; ALL: [[ANYEXT:%[0-9]+]]:_(s128) = G_ANYEXT [[FPTRUNC]](s32)
30    ; ALL: $xmm0 = COPY [[ANYEXT]](s128)
31    ; ALL: RET 0, implicit $xmm0
32    %1:_(s128) = COPY $xmm0
33    %0:_(s64) = G_TRUNC %1(s128)
34    %2:_(s32) = G_FPTRUNC %0(s64)
35    %3:_(s128) = G_ANYEXT %2(s32)
36    $xmm0 = COPY %3(s128)
37    RET 0, implicit $xmm0
38
39...
40