• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc  < %s -march=mips64el -mcpu=mips64 -mattr=n64 | FileCheck %s -check-prefix=64
2; RUN: llc  < %s -march=mips64el -mcpu=mips64r2 -mattr=n64 | FileCheck %s -check-prefix=64R2
3
4declare double @copysign(double, double) nounwind readnone
5
6declare float @copysignf(float, float) nounwind readnone
7
8define float @func2(float %d, double %f) nounwind readnone {
9entry:
10; 64: func2
11; 64: lui  $[[T0:[0-9]+]], 32767
12; 64: ori  $[[MSK0:[0-9]+]], $[[T0]], 65535
13; 64: and  $[[AND0:[0-9]+]], ${{[0-9]+}}, $[[MSK0]]
14; 64: dsrl ${{[0-9]+}}, ${{[0-9]+}}, 63
15; 64: sll  $[[SLL:[0-9]+]], ${{[0-9]+}}, 31
16; 64: or   $[[OR:[0-9]+]], $[[AND0]], $[[SLL]]
17; 64: mtc1 $[[OR]], $f0
18
19; 64R2: dext ${{[0-9]+}}, ${{[0-9]+}}, 63, 1
20; 64R2: ins  $[[INS:[0-9]+]], ${{[0-9]+}}, 31, 1
21; 64R2: mtc1 $[[INS]], $f0
22
23  %add = fadd float %d, 1.000000e+00
24  %conv = fptrunc double %f to float
25  %call = tail call float @copysignf(float %add, float %conv) nounwind readnone
26  ret float %call
27}
28
29define double @func3(double %d, float %f) nounwind readnone {
30entry:
31
32; 64: daddiu $[[T0:[0-9]+]], $zero, 1
33; 64: dsll   $[[T1:[0-9]+]], $[[T0]], 63
34; 64: daddiu $[[MSK0:[0-9]+]], $[[T1]], -1
35; 64: and    $[[AND0:[0-9]+]], ${{[0-9]+}}, $[[MSK0]]
36; 64: srl    ${{[0-9]+}}, ${{[0-9]+}}, 31
37; 64: dsll   $[[DSLL:[0-9]+]], ${{[0-9]+}}, 63
38; 64: or     $[[OR:[0-9]+]], $[[AND0]], $[[DSLL]]
39; 64: dmtc1  $[[OR]], $f0
40
41; 64R2: ext   ${{[0-9]+}}, ${{[0-9]+}}, 31, 1
42; 64R2: dins  $[[INS:[0-9]+]], ${{[0-9]+}}, 63, 1
43; 64R2: dmtc1 $[[INS]], $f0
44
45  %add = fadd double %d, 1.000000e+00
46  %conv = fpext float %f to double
47  %call = tail call double @copysign(double %add, double %conv) nounwind readnone
48  ret double %call
49}
50
51