blob: 3a9d9c73b279e7e216be15e23c1abfbc49152207 [file] [log] [blame]
Akira Hatanaka4f5c8422012-04-11 22:13:04 +00001; RUN: llc < %s -march=mipsel -mcpu=mips32 | FileCheck %s -check-prefix=32
2; RUN: llc < %s -march=mipsel -mcpu=mips32r2 | FileCheck %s -check-prefix=32R2
Daniel Sanders863c35a2014-04-14 16:24:12 +00003; RUN: llc < %s -march=mips64el -mcpu=mips4 -mattr=n64 | FileCheck %s -check-prefix=64
Akira Hatanaka4f5c8422012-04-11 22:13:04 +00004; RUN: llc < %s -march=mips64el -mcpu=mips64 -mattr=n64 | FileCheck %s -check-prefix=64
5; RUN: llc < %s -march=mips64el -mcpu=mips64r2 -mattr=n64 | FileCheck %s -check-prefix=64R2
Akira Hatanaka44eba3a2011-05-25 19:32:07 +00006
7define double @func0(double %d0, double %d1) nounwind readnone {
8entry:
Akira Hatanaka44eba3a2011-05-25 19:32:07 +00009;
Akira Hatanaka4f5c8422012-04-11 22:13:04 +000010; 32: lui $[[MSK1:[0-9]+]], 32768
11; 32: and $[[AND1:[0-9]+]], ${{[0-9]+}}, $[[MSK1]]
12; 32: lui $[[T0:[0-9]+]], 32767
13; 32: ori $[[MSK0:[0-9]+]], $[[T0]], 65535
14; 32: and $[[AND0:[0-9]+]], ${{[0-9]+}}, $[[MSK0]]
15; 32: or $[[OR:[0-9]+]], $[[AND0]], $[[AND1]]
16; 32: mtc1 $[[OR]], $f1
Akira Hatanakac5b5a8d2011-12-07 21:48:50 +000017
Akira Hatanaka4f5c8422012-04-11 22:13:04 +000018; 32R2: ext $[[EXT:[0-9]+]], ${{[0-9]+}}, 31, 1
19; 32R2: ins $[[INS:[0-9]+]], $[[EXT]], 31, 1
Daniel Sanders1f6f0f42014-06-12 11:55:58 +000020; 32R2: mthc1 $[[INS]], $f0
Akira Hatanaka4f5c8422012-04-11 22:13:04 +000021
22; 64: daddiu $[[T0:[0-9]+]], $zero, 1
23; 64: dsll $[[MSK1:[0-9]+]], $[[T0]], 63
24; 64: and $[[AND1:[0-9]+]], ${{[0-9]+}}, $[[MSK1]]
25; 64: daddiu $[[MSK0:[0-9]+]], $[[MSK1]], -1
26; 64: and $[[AND0:[0-9]+]], ${{[0-9]+}}, $[[MSK0]]
27; 64: or $[[OR:[0-9]+]], $[[AND0]], $[[AND1]]
28; 64: dmtc1 $[[OR]], $f0
29
30; 64R2: dext $[[EXT:[0-9]+]], ${{[0-9]+}}, 63, 1
31; 64R2: dins $[[INS:[0-9]+]], $[[EXT]], 63, 1
32; 64R2: dmtc1 $[[INS]], $f0
33
Akira Hatanaka44eba3a2011-05-25 19:32:07 +000034 %call = tail call double @copysign(double %d0, double %d1) nounwind readnone
35 ret double %call
36}
37
38declare double @copysign(double, double) nounwind readnone
39
40define float @func1(float %f0, float %f1) nounwind readnone {
41entry:
Akira Hatanaka4f5c8422012-04-11 22:13:04 +000042
43; 32: lui $[[MSK1:[0-9]+]], 32768
44; 32: and $[[AND1:[0-9]+]], ${{[0-9]+}}, $[[MSK1]]
45; 32: lui $[[T0:[0-9]+]], 32767
46; 32: ori $[[MSK0:[0-9]+]], $[[T0]], 65535
47; 32: and $[[AND0:[0-9]+]], ${{[0-9]+}}, $[[MSK0]]
48; 32: or $[[OR:[0-9]+]], $[[AND0]], $[[AND1]]
49; 32: mtc1 $[[OR]], $f0
50
51; 32R2: ext $[[EXT:[0-9]+]], ${{[0-9]+}}, 31, 1
52; 32R2: ins $[[INS:[0-9]+]], $[[EXT]], 31, 1
53; 32R2: mtc1 $[[INS]], $f0
54
Akira Hatanaka44eba3a2011-05-25 19:32:07 +000055 %call = tail call float @copysignf(float %f0, float %f1) nounwind readnone
56 ret float %call
57}
58
59declare float @copysignf(float, float) nounwind readnone
Akira Hatanaka4f5c8422012-04-11 22:13:04 +000060