xref: /aosp_15_r20/external/llvm/test/CodeGen/Mips/fcopysign.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mipsel -mcpu=mips32 | FileCheck %s -check-prefix=32
2*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mipsel -mcpu=mips32r2 | FileCheck %s -check-prefix=32R2
3*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mips64el -mcpu=mips4 -target-abi=n64 | FileCheck %s -check-prefix=64
4*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mips64el -mcpu=mips64 -target-abi=n64 | FileCheck %s -check-prefix=64
5*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mips64el -mcpu=mips64r2 -target-abi=n64 | FileCheck %s -check-prefix=64R2
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdefine double @func0(double %d0, double %d1) nounwind readnone {
8*9880d681SAndroid Build Coastguard Workerentry:
9*9880d681SAndroid Build Coastguard Worker;
10*9880d681SAndroid Build Coastguard Worker; 32: lui  $[[MSK1:[0-9]+]], 32768
11*9880d681SAndroid Build Coastguard Worker; 32: and  $[[AND1:[0-9]+]], ${{[0-9]+}}, $[[MSK1]]
12*9880d681SAndroid Build Coastguard Worker; 32: lui  $[[T0:[0-9]+]], 32767
13*9880d681SAndroid Build Coastguard Worker; 32: ori  $[[MSK0:[0-9]+]], $[[T0]], 65535
14*9880d681SAndroid Build Coastguard Worker; 32: and  $[[AND0:[0-9]+]], ${{[0-9]+}}, $[[MSK0]]
15*9880d681SAndroid Build Coastguard Worker; 32: or   $[[OR:[0-9]+]], $[[AND0]], $[[AND1]]
16*9880d681SAndroid Build Coastguard Worker; 32: mtc1 $[[OR]], $f1
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker; 32R2: ext  $[[EXT:[0-9]+]], ${{[0-9]+}}, 31, 1
19*9880d681SAndroid Build Coastguard Worker; 32R2: ins  $[[INS:[0-9]+]], $[[EXT]], 31, 1
20*9880d681SAndroid Build Coastguard Worker; 32R2: mthc1 $[[INS]], $f0
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; 64: daddiu $[[T0:[0-9]+]], $zero, 1
23*9880d681SAndroid Build Coastguard Worker; 64: dsll   $[[MSK1:[0-9]+]], $[[T0]], 63
24*9880d681SAndroid Build Coastguard Worker; 64: and    $[[AND1:[0-9]+]], ${{[0-9]+}}, $[[MSK1]]
25*9880d681SAndroid Build Coastguard Worker; 64: daddiu $[[MSK0:[0-9]+]], $[[MSK1]], -1
26*9880d681SAndroid Build Coastguard Worker; 64: and    $[[AND0:[0-9]+]], ${{[0-9]+}}, $[[MSK0]]
27*9880d681SAndroid Build Coastguard Worker; 64: or     $[[OR:[0-9]+]], $[[AND0]], $[[AND1]]
28*9880d681SAndroid Build Coastguard Worker; 64: dmtc1  $[[OR]], $f0
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Worker; 64R2: dextu  $[[EXT:[0-9]+]], ${{[0-9]+}}, 63, 1
31*9880d681SAndroid Build Coastguard Worker; 64R2: dins  $[[INS:[0-9]+]], $[[EXT]], 63, 1
32*9880d681SAndroid Build Coastguard Worker; 64R2: dmtc1 $[[INS]], $f0
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker  %call = tail call double @copysign(double %d0, double %d1) nounwind readnone
35*9880d681SAndroid Build Coastguard Worker  ret double %call
36*9880d681SAndroid Build Coastguard Worker}
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Workerdeclare double @copysign(double, double) nounwind readnone
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Workerdefine float @func1(float %f0, float %f1) nounwind readnone {
41*9880d681SAndroid Build Coastguard Workerentry:
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Worker; 32: lui  $[[MSK1:[0-9]+]], 32768
44*9880d681SAndroid Build Coastguard Worker; 32: and  $[[AND1:[0-9]+]], ${{[0-9]+}}, $[[MSK1]]
45*9880d681SAndroid Build Coastguard Worker; 32: lui  $[[T0:[0-9]+]], 32767
46*9880d681SAndroid Build Coastguard Worker; 32: ori  $[[MSK0:[0-9]+]], $[[T0]], 65535
47*9880d681SAndroid Build Coastguard Worker; 32: and  $[[AND0:[0-9]+]], ${{[0-9]+}}, $[[MSK0]]
48*9880d681SAndroid Build Coastguard Worker; 32: or   $[[OR:[0-9]+]], $[[AND0]], $[[AND1]]
49*9880d681SAndroid Build Coastguard Worker; 32: mtc1 $[[OR]], $f0
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Worker; 32R2: ext  $[[EXT:[0-9]+]], ${{[0-9]+}}, 31, 1
52*9880d681SAndroid Build Coastguard Worker; 32R2: ins  $[[INS:[0-9]+]], $[[EXT]], 31, 1
53*9880d681SAndroid Build Coastguard Worker; 32R2: mtc1 $[[INS]], $f0
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard Worker  %call = tail call float @copysignf(float %f0, float %f1) nounwind readnone
56*9880d681SAndroid Build Coastguard Worker  ret float %call
57*9880d681SAndroid Build Coastguard Worker}
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Workerdeclare float @copysignf(float, float) nounwind readnone
60*9880d681SAndroid Build Coastguard Worker
61