File: isel-fp64-to-sint-x86.mir

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (136 lines) | stat: -rw-r--r-- 7,149 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
# NOTE: This MIR test is required because the support for 64 bit memory ops is missing in X86 mode, Due to distinction between float/int types, support is expected in near future and there is this RFC in place https://discourse.llvm.org/t/rfc-globalisel-adding-fp-type-information-to-llt/83349. Once this support is introduced this test must be dropped and integrated into the LLVM IR tests.
# RUN: llc -O2 -mtriple=i686-linux-gnu -mattr=+x87,-sse,-sse2 -run-pass=regbankselect,instruction-select -disable-gisel-legality-check -global-isel -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes GISEL-X86

---
name:            test_double_to_int16
alignment:       16
exposesReturnsTwice: false
legalized:       true
tracksRegLiveness: true
fixedStack:
  - { id: 0, type: default, offset: 0, size: 8, alignment: 16, stack-id: default,
      isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
stack:
  - { id: 0, name: '', type: default, offset: 0, size: 2, alignment: 2,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }

body:             |
  bb.1.entry:
    ; GISEL-X86-LABEL: name: test_double_to_int16
    ; GISEL-X86: [[DEF:%[0-9]+]]:rfp64 = IMPLICIT_DEF
    ; GISEL-X86-NEXT: FP64_TO_INT16_IN_MEM %stack.0, 1, $noreg, 0, $noreg, [[DEF]], implicit-def dead $eflags :: (store (s16) into %stack.0)
    ; GISEL-X86-NEXT: [[MOV16rm:%[0-9]+]]:gr16 = MOV16rm %stack.0, 1, $noreg, 0, $noreg :: (load (s16) from %stack.0)
    ; GISEL-X86-NEXT: $ax = COPY [[MOV16rm]]
    ; GISEL-X86-NEXT: RET 0, implicit $ax
    %0:_(s64) = IMPLICIT_DEF
    %3:_(p0) = G_FRAME_INDEX %stack.0
    G_FIST %0(s64), %3(p0) :: (store (s16) into %stack.0)
    %2:_(s16) = G_LOAD %3(p0) :: (load (s16) from %stack.0)
    $ax = COPY %2(s16)
    RET 0, implicit $ax
...
---
name:            test_double_to_int32
alignment:       16
exposesReturnsTwice: false
legalized:       true
tracksRegLiveness: true
fixedStack:
  - { id: 0, type: default, offset: 0, size: 8, alignment: 16, stack-id: default,
      isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
stack:
  - { id: 0, name: '', type: default, offset: 0, size: 4, alignment: 4,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }

body:             |
  bb.1.entry:
    ; GISEL-X86-LABEL: name: test_double_to_int32
    ; GISEL-X86: [[DEF:%[0-9]+]]:rfp64 = IMPLICIT_DEF
    ; GISEL-X86-NEXT: FP64_TO_INT32_IN_MEM %stack.0, 1, $noreg, 0, $noreg, [[DEF]], implicit-def dead $eflags :: (store (s32) into %stack.0)
    ; GISEL-X86-NEXT: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %stack.0, 1, $noreg, 0, $noreg :: (load (s32) from %stack.0)
    ; GISEL-X86-NEXT: $eax = COPY [[MOV32rm]]
    ; GISEL-X86-NEXT: RET 0, implicit $eax
    %0:_(s64) = IMPLICIT_DEF
    %3:_(p0) = G_FRAME_INDEX %stack.0
    G_FIST %0(s64), %3(p0) :: (store (s32) into %stack.0)
    %2:_(s32) = G_LOAD %3(p0) :: (load (s32) from %stack.0)
    $eax = COPY %2(s32)
    RET 0, implicit $eax
...
---
name:            test_double_to_int64
alignment:       16
exposesReturnsTwice: false
legalized:       true
tracksRegLiveness: true
fixedStack:
  - { id: 0, type: default, offset: 0, size: 8, alignment: 16, stack-id: default,
      isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
stack:
  - { id: 0, name: '', type: default, offset: 0, size: 8, alignment: 8,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
body:             |
  bb.1.entry:
    ; GISEL-X86-LABEL: name: test_double_to_int64
    ; GISEL-X86: [[DEF:%[0-9]+]]:rfp64 = IMPLICIT_DEF
    ; GISEL-X86-NEXT: [[LEA32r:%[0-9]+]]:gr32 = LEA32r %stack.0, 1, $noreg, 0, $noreg
    ; GISEL-X86-NEXT: FP64_TO_INT64_IN_MEM %stack.0, 1, $noreg, 0, $noreg, [[DEF]], implicit-def dead $eflags :: (store (s64) into %stack.0)
    ; GISEL-X86-NEXT: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %stack.0, 1, $noreg, 0, $noreg :: (load (s32) from %stack.0, align 8)
    ; GISEL-X86-NEXT: [[MOV32rm1:%[0-9]+]]:gr32 = MOV32rm [[LEA32r]], 1, $noreg, 4, $noreg :: (load (s32) from %stack.0 + 4, basealign 8)
    ; GISEL-X86-NEXT: $eax = COPY [[MOV32rm]]
    ; GISEL-X86-NEXT: $edx = COPY [[MOV32rm1]]
    ; GISEL-X86-NEXT: RET 0, implicit $eax, implicit $edx
    %1:_(p0) = G_FRAME_INDEX %fixed-stack.0
    %10:_(s32) = G_LOAD %1(p0) :: (invariant load (s32) from %fixed-stack.0, align 16)
    %8:_(s32) = G_CONSTANT i32 4
    %11:_(p0) = G_PTR_ADD %1, %8(s32)
    %12:_(s32) = G_LOAD %11(p0) :: (invariant load (s32) from %fixed-stack.0 + 4, basealign 16)
    %0:_(s64) = IMPLICIT_DEF
    %5:_(p0) = G_FRAME_INDEX %stack.0
    G_FIST %0(s64), %5(p0) :: (store (s64) into %stack.0)
    %6:_(s32) = G_LOAD %5(p0) :: (load (s32) from %stack.0, align 8)
    %7:_(p0) = G_PTR_ADD %5, %8(s32)
    %9:_(s32) = G_LOAD %7(p0) :: (load (s32) from %stack.0 + 4, basealign 8)
    $eax = COPY %6(s32)
    $edx = COPY %9(s32)
    RET 0, implicit $eax, implicit $edx
...
---
name:            test_double_to_int8
alignment:       16
exposesReturnsTwice: false
legalized:       true
tracksRegLiveness: true
fixedStack:
  - { id: 0, type: default, offset: 0, size: 8, alignment: 16, stack-id: default,
      isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
stack:
  - { id: 0, name: '', type: default, offset: 0, size: 2, alignment: 2,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }

body:             |
  bb.1.entry:
    ; GISEL-X86-LABEL: name: test_double_to_int8
    ; GISEL-X86: [[DEF:%[0-9]+]]:rfp64 = IMPLICIT_DEF
    ; GISEL-X86-NEXT: FP64_TO_INT16_IN_MEM %stack.0, 1, $noreg, 0, $noreg, [[DEF]], implicit-def dead $eflags :: (store (s16) into %stack.0)
    ; GISEL-X86-NEXT: [[MOV16rm:%[0-9]+]]:gr16 = MOV16rm %stack.0, 1, $noreg, 0, $noreg :: (load (s16) from %stack.0)
    ; GISEL-X86-NEXT: [[COPY:%[0-9]+]]:gr16_abcd = COPY [[MOV16rm]]
    ; GISEL-X86-NEXT: [[COPY1:%[0-9]+]]:gr8_abcd_l = COPY [[COPY]].sub_8bit
    ; GISEL-X86-NEXT: $al = COPY [[COPY1]]
    ; GISEL-X86-NEXT: RET 0, implicit $al
    %0:_(s64) = IMPLICIT_DEF
    %4:_(p0) = G_FRAME_INDEX %stack.0
    G_FIST %0(s64), %4(p0) :: (store (s16) into %stack.0)
    %3:_(s16) = G_LOAD %4(p0) :: (load (s16) from %stack.0)
    %2:_(s8) = G_TRUNC %3(s16)
    $al = COPY %2(s8)
    RET 0, implicit $al