2015-08-11 10:45:15 +08:00
|
|
|
; RUN: llc < %s -asm-verbose=false | FileCheck %s
|
|
|
|
|
|
|
|
; Test that basic 64-bit floating-point operations assemble as expected.
|
|
|
|
|
2015-08-20 04:30:20 +08:00
|
|
|
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
|
2015-08-11 10:45:15 +08:00
|
|
|
target triple = "wasm32-unknown-unknown"
|
|
|
|
|
|
|
|
declare double @llvm.fabs.f64(double)
|
|
|
|
declare double @llvm.copysign.f64(double, double)
|
|
|
|
declare double @llvm.sqrt.f64(double)
|
2015-08-25 02:23:13 +08:00
|
|
|
declare double @llvm.ceil.f64(double)
|
|
|
|
declare double @llvm.floor.f64(double)
|
|
|
|
declare double @llvm.trunc.f64(double)
|
|
|
|
declare double @llvm.nearbyint.f64(double)
|
|
|
|
declare double @llvm.rint.f64(double)
|
2015-08-11 10:45:15 +08:00
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: fadd64:
|
|
|
|
; CHECK-NEXT: .param f64{{$}}
|
|
|
|
; CHECK-NEXT: .param f64{{$}}
|
|
|
|
; CHECK-NEXT: .result f64{{$}}
|
|
|
|
; CHECK-NEXT: @1{{$}}
|
|
|
|
; CHECK-NEXT: set_local @2, pop{{$}}
|
|
|
|
; CHECK-NEXT: @0{{$}}
|
|
|
|
; CHECK-NEXT: set_local @3, pop{{$}}
|
2015-10-10 01:50:00 +08:00
|
|
|
; CHECK-NEXT: add @3, @2{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: set_local @4, pop{{$}}
|
|
|
|
; CHECK-NEXT: return @4{{$}}
|
2015-08-11 10:45:15 +08:00
|
|
|
define double @fadd64(double %x, double %y) {
|
|
|
|
%a = fadd double %x, %y
|
|
|
|
ret double %a
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: fsub64:
|
2015-10-10 01:50:00 +08:00
|
|
|
; CHECK: sub @3, @2{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: set_local @4, pop{{$}}
|
2015-08-11 10:45:15 +08:00
|
|
|
define double @fsub64(double %x, double %y) {
|
|
|
|
%a = fsub double %x, %y
|
|
|
|
ret double %a
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: fmul64:
|
2015-10-10 01:50:00 +08:00
|
|
|
; CHECK: mul @3, @2{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: set_local @4, pop{{$}}
|
2015-08-11 10:45:15 +08:00
|
|
|
define double @fmul64(double %x, double %y) {
|
|
|
|
%a = fmul double %x, %y
|
|
|
|
ret double %a
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: fdiv64:
|
2015-10-10 01:50:00 +08:00
|
|
|
; CHECK: div @3, @2{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: set_local @4, pop{{$}}
|
2015-08-11 10:45:15 +08:00
|
|
|
define double @fdiv64(double %x, double %y) {
|
|
|
|
%a = fdiv double %x, %y
|
|
|
|
ret double %a
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: fabs64:
|
2015-10-10 01:50:00 +08:00
|
|
|
; CHECK: abs @1{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: set_local @2, pop{{$}}
|
2015-08-11 10:45:15 +08:00
|
|
|
define double @fabs64(double %x) {
|
|
|
|
%a = call double @llvm.fabs.f64(double %x)
|
|
|
|
ret double %a
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: fneg64:
|
2015-10-10 01:50:00 +08:00
|
|
|
; CHECK: neg @1{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: set_local @2, pop{{$}}
|
2015-08-11 10:45:15 +08:00
|
|
|
define double @fneg64(double %x) {
|
|
|
|
%a = fsub double -0., %x
|
|
|
|
ret double %a
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: copysign64:
|
|
|
|
; CHECK: copysign @3, @2{{$}}
|
|
|
|
; CHECK-NEXT: set_local @4, pop{{$}}
|
2015-08-11 10:45:15 +08:00
|
|
|
define double @copysign64(double %x, double %y) {
|
|
|
|
%a = call double @llvm.copysign.f64(double %x, double %y)
|
|
|
|
ret double %a
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: sqrt64:
|
|
|
|
; CHECK: sqrt @1{{$}}
|
|
|
|
; CHECK-NEXT: set_local @2, pop{{$}}
|
2015-08-11 10:45:15 +08:00
|
|
|
define double @sqrt64(double %x) {
|
|
|
|
%a = call double @llvm.sqrt.f64(double %x)
|
|
|
|
ret double %a
|
|
|
|
}
|
2015-08-25 02:23:13 +08:00
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: ceil64:
|
|
|
|
; CHECK: ceil @1{{$}}
|
|
|
|
; CHECK-NEXT: set_local @2, pop{{$}}
|
2015-08-25 02:23:13 +08:00
|
|
|
define double @ceil64(double %x) {
|
|
|
|
%a = call double @llvm.ceil.f64(double %x)
|
|
|
|
ret double %a
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: floor64:
|
|
|
|
; CHECK: floor @1{{$}}
|
|
|
|
; CHECK-NEXT: set_local @2, pop{{$}}
|
2015-08-25 02:23:13 +08:00
|
|
|
define double @floor64(double %x) {
|
|
|
|
%a = call double @llvm.floor.f64(double %x)
|
|
|
|
ret double %a
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: trunc64:
|
|
|
|
; CHECK: trunc @1{{$}}
|
|
|
|
; CHECK-NEXT: set_local @2, pop{{$}}
|
2015-08-25 02:23:13 +08:00
|
|
|
define double @trunc64(double %x) {
|
|
|
|
%a = call double @llvm.trunc.f64(double %x)
|
|
|
|
ret double %a
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: nearest64:
|
|
|
|
; CHECK: nearest @1{{$}}
|
|
|
|
; CHECK-NEXT: set_local @2, pop{{$}}
|
2015-09-26 09:09:44 +08:00
|
|
|
define double @nearest64(double %x) {
|
2015-08-25 02:23:13 +08:00
|
|
|
%a = call double @llvm.nearbyint.f64(double %x)
|
|
|
|
ret double %a
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: nearest64_via_rint:
|
|
|
|
; CHECK: nearest @1{{$}}
|
|
|
|
; CHECK-NEXT: set_local @2, pop{{$}}
|
2015-09-26 09:09:44 +08:00
|
|
|
define double @nearest64_via_rint(double %x) {
|
2015-08-25 02:23:13 +08:00
|
|
|
%a = call double @llvm.rint.f64(double %x)
|
|
|
|
ret double %a
|
|
|
|
}
|