1; RUN: llc < %s -march=x86 -mattr=+3dnow | FileCheck %s 2 3define <8 x i8> @test_pavgusb(x86_mmx %a.coerce, x86_mmx %b.coerce) nounwind readnone { 4; CHECK: pavgusb 5entry: 6 %0 = bitcast x86_mmx %a.coerce to <8 x i8> 7 %1 = bitcast x86_mmx %b.coerce to <8 x i8> 8 %2 = bitcast <8 x i8> %0 to x86_mmx 9 %3 = bitcast <8 x i8> %1 to x86_mmx 10 %4 = call x86_mmx @llvm.x86.3dnow.pavgusb(x86_mmx %2, x86_mmx %3) 11 %5 = bitcast x86_mmx %4 to <8 x i8> 12 ret <8 x i8> %5 13} 14 15declare x86_mmx @llvm.x86.3dnow.pavgusb(x86_mmx, x86_mmx) nounwind readnone 16 17define <2 x i32> @test_pf2id(<2 x float> %a) nounwind readnone { 18; CHECK: pf2id 19entry: 20 %0 = bitcast <2 x float> %a to x86_mmx 21 %1 = tail call x86_mmx @llvm.x86.3dnow.pf2id(x86_mmx %0) 22 %2 = bitcast x86_mmx %1 to <2 x i32> 23 ret <2 x i32> %2 24} 25 26declare x86_mmx @llvm.x86.3dnow.pf2id(x86_mmx) nounwind readnone 27 28define <2 x float> @test_pfacc(<2 x float> %a, <2 x float> %b) nounwind readnone { 29; CHECK: pfacc 30entry: 31 %0 = bitcast <2 x float> %a to x86_mmx 32 %1 = bitcast <2 x float> %b to x86_mmx 33 %2 = tail call x86_mmx @llvm.x86.3dnow.pfacc(x86_mmx %0, x86_mmx %1) 34 %3 = bitcast x86_mmx %2 to <2 x float> 35 ret <2 x float> %3 36} 37 38declare x86_mmx @llvm.x86.3dnow.pfacc(x86_mmx, x86_mmx) nounwind readnone 39 40define <2 x float> @test_pfadd(<2 x float> %a, <2 x float> %b) nounwind readnone { 41; CHECK: pfadd 42entry: 43 %0 = bitcast <2 x float> %a to x86_mmx 44 %1 = bitcast <2 x float> %b to x86_mmx 45 %2 = tail call x86_mmx @llvm.x86.3dnow.pfadd(x86_mmx %0, x86_mmx %1) 46 %3 = bitcast x86_mmx %2 to <2 x float> 47 ret <2 x float> %3 48} 49 50declare x86_mmx @llvm.x86.3dnow.pfadd(x86_mmx, x86_mmx) nounwind readnone 51 52define <2 x i32> @test_pfcmpeq(<2 x float> %a, <2 x float> %b) nounwind readnone { 53; CHECK: pfcmpeq 54entry: 55 %0 = bitcast <2 x float> %a to x86_mmx 56 %1 = bitcast <2 x float> %b to x86_mmx 57 %2 = tail call x86_mmx @llvm.x86.3dnow.pfcmpeq(x86_mmx %0, x86_mmx %1) 58 %3 = bitcast x86_mmx %2 to <2 x i32> 59 ret <2 x i32> %3 60} 61 62declare x86_mmx @llvm.x86.3dnow.pfcmpeq(x86_mmx, x86_mmx) nounwind readnone 63 64define <2 x i32> @test_pfcmpge(<2 x float> %a, <2 x float> %b) nounwind readnone { 65; CHECK: pfcmpge 66entry: 67 %0 = bitcast <2 x float> %a to x86_mmx 68 %1 = bitcast <2 x float> %b to x86_mmx 69 %2 = tail call x86_mmx @llvm.x86.3dnow.pfcmpge(x86_mmx %0, x86_mmx %1) 70 %3 = bitcast x86_mmx %2 to <2 x i32> 71 ret <2 x i32> %3 72} 73 74declare x86_mmx @llvm.x86.3dnow.pfcmpge(x86_mmx, x86_mmx) nounwind readnone 75 76define <2 x i32> @test_pfcmpgt(<2 x float> %a, <2 x float> %b) nounwind readnone { 77; CHECK: pfcmpgt 78entry: 79 %0 = bitcast <2 x float> %a to x86_mmx 80 %1 = bitcast <2 x float> %b to x86_mmx 81 %2 = tail call x86_mmx @llvm.x86.3dnow.pfcmpgt(x86_mmx %0, x86_mmx %1) 82 %3 = bitcast x86_mmx %2 to <2 x i32> 83 ret <2 x i32> %3 84} 85 86declare x86_mmx @llvm.x86.3dnow.pfcmpgt(x86_mmx, x86_mmx) nounwind readnone 87 88define <2 x float> @test_pfmax(<2 x float> %a, <2 x float> %b) nounwind readnone { 89; CHECK: pfmax 90entry: 91 %0 = bitcast <2 x float> %a to x86_mmx 92 %1 = bitcast <2 x float> %b to x86_mmx 93 %2 = tail call x86_mmx @llvm.x86.3dnow.pfmax(x86_mmx %0, x86_mmx %1) 94 %3 = bitcast x86_mmx %2 to <2 x float> 95 ret <2 x float> %3 96} 97 98declare x86_mmx @llvm.x86.3dnow.pfmax(x86_mmx, x86_mmx) nounwind readnone 99 100define <2 x float> @test_pfmin(<2 x float> %a, <2 x float> %b) nounwind readnone { 101; CHECK: pfmin 102entry: 103 %0 = bitcast <2 x float> %a to x86_mmx 104 %1 = bitcast <2 x float> %b to x86_mmx 105 %2 = tail call x86_mmx @llvm.x86.3dnow.pfmin(x86_mmx %0, x86_mmx %1) 106 %3 = bitcast x86_mmx %2 to <2 x float> 107 ret <2 x float> %3 108} 109 110declare x86_mmx @llvm.x86.3dnow.pfmin(x86_mmx, x86_mmx) nounwind readnone 111 112define <2 x float> @test_pfmul(<2 x float> %a, <2 x float> %b) nounwind readnone { 113; CHECK: pfmul 114entry: 115 %0 = bitcast <2 x float> %a to x86_mmx 116 %1 = bitcast <2 x float> %b to x86_mmx 117 %2 = tail call x86_mmx @llvm.x86.3dnow.pfmul(x86_mmx %0, x86_mmx %1) 118 %3 = bitcast x86_mmx %2 to <2 x float> 119 ret <2 x float> %3 120} 121 122declare x86_mmx @llvm.x86.3dnow.pfmul(x86_mmx, x86_mmx) nounwind readnone 123 124define <2 x float> @test_pfrcp(<2 x float> %a) nounwind readnone { 125; CHECK: pfrcp 126entry: 127 %0 = bitcast <2 x float> %a to x86_mmx 128 %1 = tail call x86_mmx @llvm.x86.3dnow.pfrcp(x86_mmx %0) 129 %2 = bitcast x86_mmx %1 to <2 x float> 130 ret <2 x float> %2 131} 132 133declare x86_mmx @llvm.x86.3dnow.pfrcp(x86_mmx) nounwind readnone 134 135define <2 x float> @test_pfrcpit1(<2 x float> %a, <2 x float> %b) nounwind readnone { 136; CHECK: pfrcpit1 137entry: 138 %0 = bitcast <2 x float> %a to x86_mmx 139 %1 = bitcast <2 x float> %b to x86_mmx 140 %2 = tail call x86_mmx @llvm.x86.3dnow.pfrcpit1(x86_mmx %0, x86_mmx %1) 141 %3 = bitcast x86_mmx %2 to <2 x float> 142 ret <2 x float> %3 143} 144 145declare x86_mmx @llvm.x86.3dnow.pfrcpit1(x86_mmx, x86_mmx) nounwind readnone 146 147define <2 x float> @test_pfrcpit2(<2 x float> %a, <2 x float> %b) nounwind readnone { 148; CHECK: pfrcpit2 149entry: 150 %0 = bitcast <2 x float> %a to x86_mmx 151 %1 = bitcast <2 x float> %b to x86_mmx 152 %2 = tail call x86_mmx @llvm.x86.3dnow.pfrcpit2(x86_mmx %0, x86_mmx %1) 153 %3 = bitcast x86_mmx %2 to <2 x float> 154 ret <2 x float> %3 155} 156 157declare x86_mmx @llvm.x86.3dnow.pfrcpit2(x86_mmx, x86_mmx) nounwind readnone 158 159define <2 x float> @test_pfrsqrt(<2 x float> %a) nounwind readnone { 160; CHECK: pfrsqrt 161entry: 162 %0 = bitcast <2 x float> %a to x86_mmx 163 %1 = tail call x86_mmx @llvm.x86.3dnow.pfrsqrt(x86_mmx %0) 164 %2 = bitcast x86_mmx %1 to <2 x float> 165 ret <2 x float> %2 166} 167 168declare x86_mmx @llvm.x86.3dnow.pfrsqrt(x86_mmx) nounwind readnone 169 170define <2 x float> @test_pfrsqit1(<2 x float> %a, <2 x float> %b) nounwind readnone { 171; CHECK: pfrsqit1 172entry: 173 %0 = bitcast <2 x float> %a to x86_mmx 174 %1 = bitcast <2 x float> %b to x86_mmx 175 %2 = tail call x86_mmx @llvm.x86.3dnow.pfrsqit1(x86_mmx %0, x86_mmx %1) 176 %3 = bitcast x86_mmx %2 to <2 x float> 177 ret <2 x float> %3 178} 179 180declare x86_mmx @llvm.x86.3dnow.pfrsqit1(x86_mmx, x86_mmx) nounwind readnone 181 182define <2 x float> @test_pfsub(<2 x float> %a, <2 x float> %b) nounwind readnone { 183; CHECK: pfsub 184entry: 185 %0 = bitcast <2 x float> %a to x86_mmx 186 %1 = bitcast <2 x float> %b to x86_mmx 187 %2 = tail call x86_mmx @llvm.x86.3dnow.pfsub(x86_mmx %0, x86_mmx %1) 188 %3 = bitcast x86_mmx %2 to <2 x float> 189 ret <2 x float> %3 190} 191 192declare x86_mmx @llvm.x86.3dnow.pfsub(x86_mmx, x86_mmx) nounwind readnone 193 194define <2 x float> @test_pfsubr(<2 x float> %a, <2 x float> %b) nounwind readnone { 195; CHECK: pfsubr 196entry: 197 %0 = bitcast <2 x float> %a to x86_mmx 198 %1 = bitcast <2 x float> %b to x86_mmx 199 %2 = tail call x86_mmx @llvm.x86.3dnow.pfsubr(x86_mmx %0, x86_mmx %1) 200 %3 = bitcast x86_mmx %2 to <2 x float> 201 ret <2 x float> %3 202} 203 204declare x86_mmx @llvm.x86.3dnow.pfsubr(x86_mmx, x86_mmx) nounwind readnone 205 206define <2 x float> @test_pi2fd(x86_mmx %a.coerce) nounwind readnone { 207; CHECK: pi2fd 208entry: 209 %0 = bitcast x86_mmx %a.coerce to <2 x i32> 210 %1 = bitcast <2 x i32> %0 to x86_mmx 211 %2 = call x86_mmx @llvm.x86.3dnow.pi2fd(x86_mmx %1) 212 %3 = bitcast x86_mmx %2 to <2 x float> 213 ret <2 x float> %3 214} 215 216declare x86_mmx @llvm.x86.3dnow.pi2fd(x86_mmx) nounwind readnone 217 218define <4 x i16> @test_pmulhrw(x86_mmx %a.coerce, x86_mmx %b.coerce) nounwind readnone { 219; CHECK: pmulhrw 220entry: 221 %0 = bitcast x86_mmx %a.coerce to <4 x i16> 222 %1 = bitcast x86_mmx %b.coerce to <4 x i16> 223 %2 = bitcast <4 x i16> %0 to x86_mmx 224 %3 = bitcast <4 x i16> %1 to x86_mmx 225 %4 = call x86_mmx @llvm.x86.3dnow.pmulhrw(x86_mmx %2, x86_mmx %3) 226 %5 = bitcast x86_mmx %4 to <4 x i16> 227 ret <4 x i16> %5 228} 229 230declare x86_mmx @llvm.x86.3dnow.pmulhrw(x86_mmx, x86_mmx) nounwind readnone 231 232define <2 x i32> @test_pf2iw(<2 x float> %a) nounwind readnone { 233; CHECK: pf2iw 234entry: 235 %0 = bitcast <2 x float> %a to x86_mmx 236 %1 = tail call x86_mmx @llvm.x86.3dnowa.pf2iw(x86_mmx %0) 237 %2 = bitcast x86_mmx %1 to <2 x i32> 238 ret <2 x i32> %2 239} 240 241declare x86_mmx @llvm.x86.3dnowa.pf2iw(x86_mmx) nounwind readnone 242 243define <2 x float> @test_pfnacc(<2 x float> %a, <2 x float> %b) nounwind readnone { 244; CHECK: pfnacc 245entry: 246 %0 = bitcast <2 x float> %a to x86_mmx 247 %1 = bitcast <2 x float> %b to x86_mmx 248 %2 = tail call x86_mmx @llvm.x86.3dnowa.pfnacc(x86_mmx %0, x86_mmx %1) 249 %3 = bitcast x86_mmx %2 to <2 x float> 250 ret <2 x float> %3 251} 252 253declare x86_mmx @llvm.x86.3dnowa.pfnacc(x86_mmx, x86_mmx) nounwind readnone 254 255define <2 x float> @test_pfpnacc(<2 x float> %a, <2 x float> %b) nounwind readnone { 256; CHECK: pfpnacc 257entry: 258 %0 = bitcast <2 x float> %a to x86_mmx 259 %1 = bitcast <2 x float> %b to x86_mmx 260 %2 = tail call x86_mmx @llvm.x86.3dnowa.pfpnacc(x86_mmx %0, x86_mmx %1) 261 %3 = bitcast x86_mmx %2 to <2 x float> 262 ret <2 x float> %3 263} 264 265declare x86_mmx @llvm.x86.3dnowa.pfpnacc(x86_mmx, x86_mmx) nounwind readnone 266 267define <2 x float> @test_pi2fw(x86_mmx %a.coerce) nounwind readnone { 268; CHECK: pi2fw 269entry: 270 %0 = bitcast x86_mmx %a.coerce to <2 x i32> 271 %1 = bitcast <2 x i32> %0 to x86_mmx 272 %2 = call x86_mmx @llvm.x86.3dnowa.pi2fw(x86_mmx %1) 273 %3 = bitcast x86_mmx %2 to <2 x float> 274 ret <2 x float> %3 275} 276 277declare x86_mmx @llvm.x86.3dnowa.pi2fw(x86_mmx) nounwind readnone 278 279define <2 x float> @test_pswapdsf(<2 x float> %a) nounwind readnone { 280; CHECK: pswapd {{.*#+}} mm0 = mem[1,0] 281entry: 282 %0 = bitcast <2 x float> %a to x86_mmx 283 %1 = tail call x86_mmx @llvm.x86.3dnowa.pswapd(x86_mmx %0) 284 %2 = bitcast x86_mmx %1 to <2 x float> 285 ret <2 x float> %2 286} 287 288define <2 x i32> @test_pswapdsi(<2 x i32> %a) nounwind readnone { 289; CHECK: pswapd {{.*#+}} mm0 = mem[1,0] 290entry: 291 %0 = bitcast <2 x i32> %a to x86_mmx 292 %1 = tail call x86_mmx @llvm.x86.3dnowa.pswapd(x86_mmx %0) 293 %2 = bitcast x86_mmx %1 to <2 x i32> 294 ret <2 x i32> %2 295} 296 297declare x86_mmx @llvm.x86.3dnowa.pswapd(x86_mmx) nounwind readnone 298