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
4 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
6 define float @max(float noundef %a, float noundef %b) #0 {
8 %U = fcmp uno float %a, %b
9 br i1 %U, label %UL, label %NU
12 %GT = fcmp ogt float %a, %b
13 br i1 %GT, label %EXIT, label %NGT
16 %LT = fcmp one float %a, %b
17 br i1 %LT, label %EXIT, label %EQ
20 %bc = bitcast float %a to i32
21 %cmp = icmp slt i32 %bc, 0
22 %eq = select i1 %cmp, float %a, float %b
26 %AU = fcmp uno float %a, %a
27 br i1 %AU, label %EXIT, label %ULB
32 EXIT: ; preds = %ULB, %UL, %EQ, %NGT, %NU
33 %res = phi float [ %a, %NU ], [ %b, %NGT ], [ %a, %UL ], [ %eq, %EQ ], [ %b, %ULB ]
37 attributes #0 = { "target-cpu"="skylake" }
43 exposesReturnsTwice: false
45 regBankSelected: false
48 tracksRegLiveness: true
51 callsUnwindInit: false
57 failsVerification: false
58 tracksDebugUserValues: false
60 - { id: 0, class: fr32, preferred-register: '' }
61 - { id: 1, class: fr32, preferred-register: '' }
62 - { id: 2, class: fr32, preferred-register: '' }
63 - { id: 3, class: fr32, preferred-register: '' }
64 - { id: 4, class: gr32, preferred-register: '' }
66 - { reg: '$xmm0', virtual-reg: '%2' }
67 - { reg: '$xmm1', virtual-reg: '%3' }
69 isFrameAddressTaken: false
70 isReturnAddressTaken: false
80 maxCallFrameSize: 4294967295
81 cvBytesOfCalleeSavedRegisters: 0
82 hasOpaqueSPAdjustment: false
84 hasMustTailInVarArgFunc: false
92 debugValueSubstitutions: []
94 machineFunctionInfo: {}
96 ; CHECK-LABEL: name: max
98 ; CHECK-NEXT: successors: %bb.6(0x00000800), %bb.1(0x7ffff800)
99 ; CHECK-NEXT: liveins: $xmm0, $xmm1
101 ; CHECK-NEXT: [[COPY:%[0-9]+]]:fr32 = COPY $xmm1
102 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fr32 = COPY $xmm0
103 ; CHECK-NEXT: nofpexcept VUCOMISSrr [[COPY1]], [[COPY]], implicit-def $eflags, implicit $mxcsr
104 ; CHECK-NEXT: JCC_1 %bb.6, 10, implicit $eflags
105 ; CHECK-NEXT: JMP_1 %bb.1
107 ; CHECK-NEXT: bb.1.NU:
108 ; CHECK-NEXT: successors: %bb.8(0x40000000), %bb.2(0x40000000)
109 ; CHECK-NEXT: liveins: $eflags
111 ; CHECK-NEXT: JCC_1 %bb.8, 7, implicit $eflags
112 ; CHECK-NEXT: JMP_1 %bb.2
114 ; CHECK-NEXT: bb.2.NGT:
115 ; CHECK-NEXT: successors: %bb.8(0x50000000), %bb.3(0x30000000)
117 ; CHECK-NEXT: nofpexcept VUCOMISSrr [[COPY1]], [[COPY]], implicit-def $eflags, implicit $mxcsr
118 ; CHECK-NEXT: JCC_1 %bb.8, 5, implicit $eflags
119 ; CHECK-NEXT: JMP_1 %bb.3
121 ; CHECK-NEXT: bb.3.EQ:
122 ; CHECK-NEXT: successors: %bb.4(0x40000000), %bb.5(0x40000000)
124 ; CHECK-NEXT: [[VMOVSS2DIrr:%[0-9]+]]:gr32 = VMOVSS2DIrr [[COPY1]]
125 ; CHECK-NEXT: TEST32rr [[VMOVSS2DIrr]], [[VMOVSS2DIrr]], implicit-def $eflags
126 ; CHECK-NEXT: JCC_1 %bb.5, 8, implicit $eflags
128 ; CHECK-NEXT: bb.4.EQ:
129 ; 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)
149 ; CHECK-NEXT: bb.8.EXIT:
150 ; CHECK-NEXT: [[PHI1:%[0-9]+]]:fr32 = PHI [[COPY1]], %bb.1, [[COPY]], %bb.2, [[PHI]], %bb.5, [[COPY1]], %bb.6, [[COPY]], %bb.7
151 ; CHECK-NEXT: $xmm0 = COPY [[PHI1]]
152 ; CHECK-NEXT: RET 0, $xmm0
154 successors: %bb.4(0x00000800), %bb.1(0x7ffff800)
155 liveins: $xmm0, $xmm1
159 nofpexcept VUCOMISSrr %2, %3, implicit-def $eflags, implicit $mxcsr
160 JCC_1 %bb.4, 10, implicit $eflags
164 successors: %bb.6(0x40000000), %bb.2(0x40000000)
166 nofpexcept VUCOMISSrr %2, %3, implicit-def $eflags, implicit $mxcsr
167 JCC_1 %bb.6, 7, implicit $eflags
171 successors: %bb.6(0x50000000), %bb.3(0x30000000)
173 nofpexcept VUCOMISSrr %2, %3, implicit-def $eflags, implicit $mxcsr
174 JCC_1 %bb.6, 5, implicit $eflags
178 successors: %bb.7(0x40000000), %bb.8(0x40000000)
180 %4:gr32 = VMOVSS2DIrr %2
181 TEST32rr %4, %4, implicit-def $eflags
182 JCC_1 %bb.8, 8, implicit $eflags
185 successors: %bb.8(0x80000000)
189 successors: %bb.6(0x80000000)
191 %0:fr32 = PHI %3, %bb.7, %2, %bb.3
195 successors: %bb.6(0x00000800), %bb.5(0x7ffff800)
197 nofpexcept VUCOMISSrr %2, %2, implicit-def $eflags, implicit $mxcsr
198 JCC_1 %bb.6, 10, implicit $eflags
202 successors: %bb.6(0x80000000)
206 %1:fr32 = PHI %2, %bb.1, %3, %bb.2, %0, %bb.8, %2, %bb.4, %3, %bb.5