1 ; RUN: llc < %s -asm-verbose=false | FileCheck %s
3 ; Test that basic 64-bit floating-point operations assemble as expected.
5 target datalayout = "e-p:32:32-i64:64-n32:64-S128"
6 target triple = "wasm32-unknown-unknown"
8 declare double @llvm.fabs.f64(double)
9 declare double @llvm.copysign.f64(double, double)
10 declare double @llvm.sqrt.f64(double)
11 declare double @llvm.ceil.f64(double)
12 declare double @llvm.floor.f64(double)
13 declare double @llvm.trunc.f64(double)
14 declare double @llvm.nearbyint.f64(double)
15 declare double @llvm.rint.f64(double)
17 ; CHECK-LABEL: fadd64:
18 ; CHECK-NEXT: .param f64{{$}}
19 ; CHECK-NEXT: .param f64{{$}}
20 ; CHECK-NEXT: .result f64{{$}}
22 ; CHECK-NEXT: set_local @2, pop{{$}}
24 ; CHECK-NEXT: set_local @3, pop{{$}}
25 ; CHECK-NEXT: add @3, @2{{$}}
26 ; CHECK-NEXT: set_local @4, pop{{$}}
27 ; CHECK-NEXT: return @4{{$}}
28 define double @fadd64(double %x, double %y) {
29 %a = fadd double %x, %y
33 ; CHECK-LABEL: fsub64:
34 ; CHECK: sub @3, @2{{$}}
35 ; CHECK-NEXT: set_local @4, pop{{$}}
36 define double @fsub64(double %x, double %y) {
37 %a = fsub double %x, %y
41 ; CHECK-LABEL: fmul64:
42 ; CHECK: mul @3, @2{{$}}
43 ; CHECK-NEXT: set_local @4, pop{{$}}
44 define double @fmul64(double %x, double %y) {
45 %a = fmul double %x, %y
49 ; CHECK-LABEL: fdiv64:
50 ; CHECK: div @3, @2{{$}}
51 ; CHECK-NEXT: set_local @4, pop{{$}}
52 define double @fdiv64(double %x, double %y) {
53 %a = fdiv double %x, %y
57 ; CHECK-LABEL: fabs64:
59 ; CHECK-NEXT: set_local @2, pop{{$}}
60 define double @fabs64(double %x) {
61 %a = call double @llvm.fabs.f64(double %x)
65 ; CHECK-LABEL: fneg64:
67 ; CHECK-NEXT: set_local @2, pop{{$}}
68 define double @fneg64(double %x) {
69 %a = fsub double -0., %x
73 ; CHECK-LABEL: copysign64:
74 ; CHECK: copysign @3, @2{{$}}
75 ; CHECK-NEXT: set_local @4, pop{{$}}
76 define double @copysign64(double %x, double %y) {
77 %a = call double @llvm.copysign.f64(double %x, double %y)
81 ; CHECK-LABEL: sqrt64:
83 ; CHECK-NEXT: set_local @2, pop{{$}}
84 define double @sqrt64(double %x) {
85 %a = call double @llvm.sqrt.f64(double %x)
89 ; CHECK-LABEL: ceil64:
91 ; CHECK-NEXT: set_local @2, pop{{$}}
92 define double @ceil64(double %x) {
93 %a = call double @llvm.ceil.f64(double %x)
97 ; CHECK-LABEL: floor64:
98 ; CHECK: floor @1{{$}}
99 ; CHECK-NEXT: set_local @2, pop{{$}}
100 define double @floor64(double %x) {
101 %a = call double @llvm.floor.f64(double %x)
105 ; CHECK-LABEL: trunc64:
106 ; CHECK: trunc @1{{$}}
107 ; CHECK-NEXT: set_local @2, pop{{$}}
108 define double @trunc64(double %x) {
109 %a = call double @llvm.trunc.f64(double %x)
113 ; CHECK-LABEL: nearest64:
114 ; CHECK: nearest @1{{$}}
115 ; CHECK-NEXT: set_local @2, pop{{$}}
116 define double @nearest64(double %x) {
117 %a = call double @llvm.nearbyint.f64(double %x)
121 ; CHECK-LABEL: nearest64_via_rint:
122 ; CHECK: nearest @1{{$}}
123 ; CHECK-NEXT: set_local @2, pop{{$}}
124 define double @nearest64_via_rint(double %x) {
125 %a = call double @llvm.rint.f64(double %x)