1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
2 # RUN: llc -mtriple=x86_64 -verify-machineinstrs --run-pass=machine-cse -o - %s | FileCheck %s
3 # RUN: llc -mtriple=x86_64 -passes=machine-cse -o - %s | FileCheck %s
5 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
7 define float @max(float noundef %a, float noundef %b) #0 {
9 %U = fcmp uno float %a, %b
10 br i1 %U, label %UL, label %NU
13 %GT = fcmp ogt float %a, %b
14 br i1 %GT, label %EXIT, label %NGT
17 %LT = fcmp one float %a, %b
18 br i1 %LT, label %EXIT, label %EQ
21 %bc = bitcast float %a to i32
22 %cmp = icmp slt i32 %bc, 0
23 %eq = select i1 %cmp, float %a, float %b
27 %AU = fcmp uno float %a, %a
28 br i1 %AU, label %EXIT, label %ULB
33 EXIT: ; preds = %ULB, %UL, %EQ, %NGT, %NU
34 %res = phi float [ %a, %NU ], [ %b, %NGT ], [ %a, %UL ], [ %eq, %EQ ], [ %b, %ULB ]
38 attributes #0 = { "target-cpu"="skylake" }
44 exposesReturnsTwice: false
46 regBankSelected: false
49 tracksRegLiveness: true
52 callsUnwindInit: false
58 failsVerification: false
59 tracksDebugUserValues: false
61 - { id: 0, class: fr32, preferred-register: '' }
62 - { id: 1, class: fr32, preferred-register: '' }
63 - { id: 2, class: fr32, preferred-register: '' }
64 - { id: 3, class: fr32, preferred-register: '' }
65 - { id: 4, class: gr32, preferred-register: '' }
67 - { reg: '$xmm0', virtual-reg: '%2' }
68 - { reg: '$xmm1', virtual-reg: '%3' }
70 isFrameAddressTaken: false
71 isReturnAddressTaken: false
81 maxCallFrameSize: 4294967295
82 cvBytesOfCalleeSavedRegisters: 0
83 hasOpaqueSPAdjustment: false
85 hasMustTailInVarArgFunc: false
93 debugValueSubstitutions: []
95 machineFunctionInfo: {}
97 ; CHECK-LABEL: name: max
99 ; CHECK-NEXT: successors: %bb.6(0x00000800), %bb.1(0x7ffff800)
100 ; CHECK-NEXT: liveins: $xmm0, $xmm1
102 ; CHECK-NEXT: [[COPY:%[0-9]+]]:fr32 = COPY $xmm1
103 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fr32 = COPY $xmm0
104 ; CHECK-NEXT: nofpexcept VUCOMISSrr [[COPY1]], [[COPY]], implicit-def $eflags, implicit $mxcsr
105 ; CHECK-NEXT: JCC_1 %bb.6, 10, implicit $eflags
106 ; CHECK-NEXT: JMP_1 %bb.1
108 ; CHECK-NEXT: bb.1.NU:
109 ; CHECK-NEXT: successors: %bb.8(0x40000000), %bb.2(0x40000000)
110 ; CHECK-NEXT: liveins: $eflags
112 ; CHECK-NEXT: JCC_1 %bb.8, 7, implicit $eflags
113 ; CHECK-NEXT: JMP_1 %bb.2
115 ; CHECK-NEXT: bb.2.NGT:
116 ; CHECK-NEXT: successors: %bb.8(0x50000000), %bb.3(0x30000000)
118 ; CHECK-NEXT: nofpexcept VUCOMISSrr [[COPY1]], [[COPY]], implicit-def $eflags, implicit $mxcsr
119 ; CHECK-NEXT: JCC_1 %bb.8, 5, implicit $eflags
120 ; CHECK-NEXT: JMP_1 %bb.3
122 ; CHECK-NEXT: bb.3.EQ:
123 ; CHECK-NEXT: successors: %bb.4(0x40000000), %bb.5(0x40000000)
125 ; CHECK-NEXT: [[VMOVSS2DIrr:%[0-9]+]]:gr32 = VMOVSS2DIrr [[COPY1]]
126 ; CHECK-NEXT: TEST32rr [[VMOVSS2DIrr]], [[VMOVSS2DIrr]], implicit-def $eflags
127 ; CHECK-NEXT: JCC_1 %bb.5, 8, implicit $eflags
129 ; CHECK-NEXT: bb.4.EQ:
130 ; CHECK-NEXT: successors: %bb.5(0x80000000)
132 ; CHECK-NEXT: bb.5.EQ:
133 ; CHECK-NEXT: successors: %bb.8(0x80000000)
135 ; CHECK-NEXT: [[PHI:%[0-9]+]]:fr32 = PHI [[COPY]], %bb.4, [[COPY1]], %bb.3
136 ; CHECK-NEXT: JMP_1 %bb.8
138 ; CHECK-NEXT: bb.6.UL:
139 ; CHECK-NEXT: successors: %bb.8(0x00000800), %bb.7(0x7ffff800)
141 ; CHECK-NEXT: nofpexcept VUCOMISSrr [[COPY1]], [[COPY1]], implicit-def $eflags, implicit $mxcsr
142 ; CHECK-NEXT: JCC_1 %bb.8, 10, implicit $eflags
143 ; CHECK-NEXT: JMP_1 %bb.7
145 ; CHECK-NEXT: bb.7.ULB:
146 ; CHECK-NEXT: successors: %bb.8(0x80000000)
148 ; CHECK-NEXT: bb.8.EXIT:
149 ; CHECK-NEXT: [[PHI1:%[0-9]+]]:fr32 = PHI [[COPY1]], %bb.1, [[COPY]], %bb.2, [[PHI]], %bb.5, [[COPY1]], %bb.6, [[COPY]], %bb.7
150 ; CHECK-NEXT: $xmm0 = COPY [[PHI1]]
151 ; CHECK-NEXT: RET 0, $xmm0
153 successors: %bb.4(0x00000800), %bb.1(0x7ffff800)
154 liveins: $xmm0, $xmm1
158 nofpexcept VUCOMISSrr %2, %3, implicit-def $eflags, implicit $mxcsr
159 JCC_1 %bb.4, 10, implicit $eflags
163 successors: %bb.6(0x40000000), %bb.2(0x40000000)
165 nofpexcept VUCOMISSrr %2, %3, implicit-def $eflags, implicit $mxcsr
166 JCC_1 %bb.6, 7, implicit $eflags
170 successors: %bb.6(0x50000000), %bb.3(0x30000000)
172 nofpexcept VUCOMISSrr %2, %3, implicit-def $eflags, implicit $mxcsr
173 JCC_1 %bb.6, 5, implicit $eflags
177 successors: %bb.7(0x40000000), %bb.8(0x40000000)
179 %4:gr32 = VMOVSS2DIrr %2
180 TEST32rr %4, %4, implicit-def $eflags
181 JCC_1 %bb.8, 8, implicit $eflags
184 successors: %bb.8(0x80000000)
188 successors: %bb.6(0x80000000)
190 %0:fr32 = PHI %3, %bb.7, %2, %bb.3
194 successors: %bb.6(0x00000800), %bb.5(0x7ffff800)
196 nofpexcept VUCOMISSrr %2, %2, implicit-def $eflags, implicit $mxcsr
197 JCC_1 %bb.6, 10, implicit $eflags
201 successors: %bb.6(0x80000000)
205 %1:fr32 = PHI %2, %bb.1, %3, %bb.2, %0, %bb.8, %2, %bb.4, %3, %bb.5