summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/GlobalISel/select-fdiv-scalar.mir
blob: bd36a8e06268e7f09c2572ceae81ea9bd132dcf2 (plain)
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=x86_64-linux-gnu                                  -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=NO_AVX512VL --check-prefix=NO_AVX512F --check-prefix=SSE
# RUN: llc -mtriple=x86_64-linux-gnu -mattr=+avx                      -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=NO_AVX512VL --check-prefix=NO_AVX512F --check-prefix=AVX
# RUN: llc -mtriple=x86_64-linux-gnu -mattr=+avx512f                  -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=NO_AVX512VL --check-prefix=AVX512ALL --check-prefix=AVX512F
# RUN: llc -mtriple=x86_64-linux-gnu -mattr=+avx512f -mattr=+avx512vl -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=AVX512ALL --check-prefix=AVX512VL
--- |

  define float @test_fdiv_float(float %arg1, float %arg2) {
    %ret = fdiv float %arg1, %arg2
    ret float %ret
  }

  define double @test_fdiv_double(double %arg1, double %arg2) {
    %ret = fdiv double %arg1, %arg2
    ret double %ret
  }

...
---
name:            test_fdiv_float
alignment:       4
legalized:       true
regBankSelected: true
#
registers:
  - { id: 0, class: vecr, preferred-register: '' }
  - { id: 1, class: vecr, preferred-register: '' }
  - { id: 2, class: vecr, preferred-register: '' }
  - { id: 3, class: vecr, preferred-register: '' }
  - { id: 4, class: vecr, preferred-register: '' }
  - { id: 5, class: vecr, preferred-register: '' }
liveins:
fixedStack:
stack:
constants:
#
#
body:             |
  bb.1 (%ir-block.0):
    liveins: $xmm0, $xmm1

    ; SSE-LABEL: name: test_fdiv_float
    ; SSE: [[COPY:%[0-9]+]]:vr128 = COPY $xmm0
    ; SSE: [[COPY1:%[0-9]+]]:fr32 = COPY [[COPY]]
    ; SSE: [[COPY2:%[0-9]+]]:vr128 = COPY $xmm1
    ; SSE: [[COPY3:%[0-9]+]]:fr32 = COPY [[COPY2]]
    ; SSE: [[DIVSSrr:%[0-9]+]]:fr32 = DIVSSrr [[COPY1]], [[COPY3]]
    ; SSE: [[COPY4:%[0-9]+]]:vr128 = COPY [[DIVSSrr]]
    ; SSE: $xmm0 = COPY [[COPY4]]
    ; SSE: RET 0, implicit $xmm0
    ; AVX-LABEL: name: test_fdiv_float
    ; AVX: [[COPY:%[0-9]+]]:vr128 = COPY $xmm0
    ; AVX: [[COPY1:%[0-9]+]]:fr32 = COPY [[COPY]]
    ; AVX: [[COPY2:%[0-9]+]]:vr128 = COPY $xmm1
    ; AVX: [[COPY3:%[0-9]+]]:fr32 = COPY [[COPY2]]
    ; AVX: [[VDIVSSrr:%[0-9]+]]:fr32 = VDIVSSrr [[COPY1]], [[COPY3]]
    ; AVX: [[COPY4:%[0-9]+]]:vr128 = COPY [[VDIVSSrr]]
    ; AVX: $xmm0 = COPY [[COPY4]]
    ; AVX: RET 0, implicit $xmm0
    ; AVX512F-LABEL: name: test_fdiv_float
    ; AVX512F: [[COPY:%[0-9]+]]:vr128x = COPY $xmm0
    ; AVX512F: [[COPY1:%[0-9]+]]:fr32x = COPY [[COPY]]
    ; AVX512F: [[COPY2:%[0-9]+]]:vr128x = COPY $xmm1
    ; AVX512F: [[COPY3:%[0-9]+]]:fr32x = COPY [[COPY2]]
    ; AVX512F: [[VDIVSSZrr:%[0-9]+]]:fr32x = VDIVSSZrr [[COPY1]], [[COPY3]]
    ; AVX512F: [[COPY4:%[0-9]+]]:vr128x = COPY [[VDIVSSZrr]]
    ; AVX512F: $xmm0 = COPY [[COPY4]]
    ; AVX512F: RET 0, implicit $xmm0
    ; AVX512VL-LABEL: name: test_fdiv_float
    ; AVX512VL: [[COPY:%[0-9]+]]:vr128x = COPY $xmm0
    ; AVX512VL: [[COPY1:%[0-9]+]]:fr32x = COPY [[COPY]]
    ; AVX512VL: [[COPY2:%[0-9]+]]:vr128x = COPY $xmm1
    ; AVX512VL: [[COPY3:%[0-9]+]]:fr32x = COPY [[COPY2]]
    ; AVX512VL: [[VDIVSSZrr:%[0-9]+]]:fr32x = VDIVSSZrr [[COPY1]], [[COPY3]]
    ; AVX512VL: [[COPY4:%[0-9]+]]:vr128x = COPY [[VDIVSSZrr]]
    ; AVX512VL: $xmm0 = COPY [[COPY4]]
    ; AVX512VL: RET 0, implicit $xmm0
    %2:vecr(s128) = COPY $xmm0
    %0:vecr(s32) = G_TRUNC %2(s128)
    %3:vecr(s128) = COPY $xmm1
    %1:vecr(s32) = G_TRUNC %3(s128)
    %4:vecr(s32) = G_FDIV %0, %1
    %5:vecr(s128) = G_ANYEXT %4(s32)
    $xmm0 = COPY %5(s128)
    RET 0, implicit $xmm0

...
---
name:            test_fdiv_double
alignment:       4
legalized:       true
regBankSelected: true
#
registers:
  - { id: 0, class: vecr, preferred-register: '' }
  - { id: 1, class: vecr, preferred-register: '' }
  - { id: 2, class: vecr, preferred-register: '' }
  - { id: 3, class: vecr, preferred-register: '' }
  - { id: 4, class: vecr, preferred-register: '' }
  - { id: 5, class: vecr, preferred-register: '' }
liveins:
fixedStack:
stack:
constants:
#
#
body:             |
  bb.1 (%ir-block.0):
    liveins: $xmm0, $xmm1

    ; SSE-LABEL: name: test_fdiv_double
    ; SSE: [[COPY:%[0-9]+]]:vr128 = COPY $xmm0
    ; SSE: [[COPY1:%[0-9]+]]:fr64 = COPY [[COPY]]
    ; SSE: [[COPY2:%[0-9]+]]:vr128 = COPY $xmm1
    ; SSE: [[COPY3:%[0-9]+]]:fr64 = COPY [[COPY2]]
    ; SSE: [[DIVSDrr:%[0-9]+]]:fr64 = DIVSDrr [[COPY1]], [[COPY3]]
    ; SSE: [[COPY4:%[0-9]+]]:vr128 = COPY [[DIVSDrr]]
    ; SSE: $xmm0 = COPY [[COPY4]]
    ; SSE: RET 0, implicit $xmm0
    ; AVX-LABEL: name: test_fdiv_double
    ; AVX: [[COPY:%[0-9]+]]:vr128 = COPY $xmm0
    ; AVX: [[COPY1:%[0-9]+]]:fr64 = COPY [[COPY]]
    ; AVX: [[COPY2:%[0-9]+]]:vr128 = COPY $xmm1
    ; AVX: [[COPY3:%[0-9]+]]:fr64 = COPY [[COPY2]]
    ; AVX: [[VDIVSDrr:%[0-9]+]]:fr64 = VDIVSDrr [[COPY1]], [[COPY3]]
    ; AVX: [[COPY4:%[0-9]+]]:vr128 = COPY [[VDIVSDrr]]
    ; AVX: $xmm0 = COPY [[COPY4]]
    ; AVX: RET 0, implicit $xmm0
    ; AVX512F-LABEL: name: test_fdiv_double
    ; AVX512F: [[COPY:%[0-9]+]]:vr128x = COPY $xmm0
    ; AVX512F: [[COPY1:%[0-9]+]]:fr64x = COPY [[COPY]]
    ; AVX512F: [[COPY2:%[0-9]+]]:vr128x = COPY $xmm1
    ; AVX512F: [[COPY3:%[0-9]+]]:fr64x = COPY [[COPY2]]
    ; AVX512F: [[VDIVSDZrr:%[0-9]+]]:fr64x = VDIVSDZrr [[COPY1]], [[COPY3]]
    ; AVX512F: [[COPY4:%[0-9]+]]:vr128x = COPY [[VDIVSDZrr]]
    ; AVX512F: $xmm0 = COPY [[COPY4]]
    ; AVX512F: RET 0, implicit $xmm0
    ; AVX512VL-LABEL: name: test_fdiv_double
    ; AVX512VL: [[COPY:%[0-9]+]]:vr128x = COPY $xmm0
    ; AVX512VL: [[COPY1:%[0-9]+]]:fr64x = COPY [[COPY]]
    ; AVX512VL: [[COPY2:%[0-9]+]]:vr128x = COPY $xmm1
    ; AVX512VL: [[COPY3:%[0-9]+]]:fr64x = COPY [[COPY2]]
    ; AVX512VL: [[VDIVSDZrr:%[0-9]+]]:fr64x = VDIVSDZrr [[COPY1]], [[COPY3]]
    ; AVX512VL: [[COPY4:%[0-9]+]]:vr128x = COPY [[VDIVSDZrr]]
    ; AVX512VL: $xmm0 = COPY [[COPY4]]
    ; AVX512VL: RET 0, implicit $xmm0
    %2:vecr(s128) = COPY $xmm0
    %0:vecr(s64) = G_TRUNC %2(s128)
    %3:vecr(s128) = COPY $xmm1
    %1:vecr(s64) = G_TRUNC %3(s128)
    %4:vecr(s64) = G_FDIV %0, %1
    %5:vecr(s128) = G_ANYEXT %4(s64)
    $xmm0 = COPY %5(s128)
    RET 0, implicit $xmm0

...
OpenPOWER on IntegriCloud