llvm/test/CodeGen/X86/fp128-libcalls.ll
Chih-Hung Hsieh 3a1999a311 [X86] Part 2 to fix x86-64 fp128 calling convention.
Part 1 was submitted in http://reviews.llvm.org/D15134.
Changes in this part:
* X86RegisterInfo.td, X86RecognizableInstr.cpp: Add FR128 register class.
* X86CallingConv.td: Pass f128 values in XMM registers or on stack.
* X86InstrCompiler.td, X86InstrInfo.td, X86InstrSSE.td:
  Add instruction selection patterns for f128.
* X86ISelLowering.cpp:
  When target has MMX registers, configure MVT::f128 in FR128RegClass,
  with TypeSoftenFloat action, and custom actions for some opcodes.
  Add missed cases of MVT::f128 in places that handle f32, f64, or vector types.
  Add TODO comment to support f128 type in inline assembly code.
* SelectionDAGBuilder.cpp:
  Fix infinite loop when f128 type can have
  VT == TLI.getTypeToTransformTo(Ctx, VT).
* Add unit tests for x86-64 fp128 type.

Differential Revision: http://reviews.llvm.org/D11438



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255558 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14 22:08:36 +00:00

108 lines
2.8 KiB
LLVM

; RUN: llc < %s -O2 -mtriple=x86_64-linux-android -mattr=+mmx | FileCheck %s
; RUN: llc < %s -O2 -mtriple=x86_64-linux-gnu -mattr=+mmx | FileCheck %s
; Check all soft floating point library function calls.
@vf64 = common global double 0.000000e+00, align 8
@vf128 = common global fp128 0xL00000000000000000000000000000000, align 16
define void @Test128Add(fp128 %d1, fp128 %d2) {
entry:
%add = fadd fp128 %d1, %d2
store fp128 %add, fp128* @vf128, align 16
ret void
; CHECK-LABEL: Test128Add:
; CHECK: callq __addtf3
; CHECK-NEXT: movaps %xmm0, vf128(%rip)
; CHECK: retq
}
define void @Test128_1Add(fp128 %d1){
entry:
%0 = load fp128, fp128* @vf128, align 16
%add = fadd fp128 %0, %d1
store fp128 %add, fp128* @vf128, align 16
ret void
; CHECK-LABEL: Test128_1Add:
; CHECK: movaps %xmm0, %xmm1
; CHECK-NEXT: movaps vf128(%rip), %xmm0
; CHECK-NEXT: callq __addtf3
; CHECK-NEXT: movaps %xmm0, vf128(%rip)
; CHECK: retq
}
define void @Test128Sub(fp128 %d1, fp128 %d2){
entry:
%sub = fsub fp128 %d1, %d2
store fp128 %sub, fp128* @vf128, align 16
ret void
; CHECK-LABEL: Test128Sub:
; CHECK: callq __subtf3
; CHECK-NEXT: movaps %xmm0, vf128(%rip)
; CHECK: retq
}
define void @Test128_1Sub(fp128 %d1){
entry:
%0 = load fp128, fp128* @vf128, align 16
%sub = fsub fp128 %0, %d1
store fp128 %sub, fp128* @vf128, align 16
ret void
; CHECK-LABEL: Test128_1Sub:
; CHECK: movaps %xmm0, %xmm1
; CHECK-NEXT: movaps vf128(%rip), %xmm0
; CHECK-NEXT: callq __subtf3
; CHECK-NEXT: movaps %xmm0, vf128(%rip)
; CHECK: retq
}
define void @Test128Mul(fp128 %d1, fp128 %d2){
entry:
%mul = fmul fp128 %d1, %d2
store fp128 %mul, fp128* @vf128, align 16
ret void
; CHECK-LABEL: Test128Mul:
; CHECK: callq __multf3
; CHECK-NEXT: movaps %xmm0, vf128(%rip)
; CHECK: retq
}
define void @Test128_1Mul(fp128 %d1){
entry:
%0 = load fp128, fp128* @vf128, align 16
%mul = fmul fp128 %0, %d1
store fp128 %mul, fp128* @vf128, align 16
ret void
; CHECK-LABEL: Test128_1Mul:
; CHECK: movaps %xmm0, %xmm1
; CHECK-NEXT: movaps vf128(%rip), %xmm0
; CHECK-NEXT: callq __multf3
; CHECK-NEXT: movaps %xmm0, vf128(%rip)
; CHECK: retq
}
define void @Test128Div(fp128 %d1, fp128 %d2){
entry:
%div = fdiv fp128 %d1, %d2
store fp128 %div, fp128* @vf128, align 16
ret void
; CHECK-LABEL: Test128Div:
; CHECK: callq __divtf3
; CHECK-NEXT: movaps %xmm0, vf128(%rip)
; CHECK: retq
}
define void @Test128_1Div(fp128 %d1){
entry:
%0 = load fp128, fp128* @vf128, align 16
%div = fdiv fp128 %0, %d1
store fp128 %div, fp128* @vf128, align 16
ret void
; CHECK-LABEL: Test128_1Div:
; CHECK: movaps %xmm0, %xmm1
; CHECK-NEXT: movaps vf128(%rip), %xmm0
; CHECK-NEXT: callq __divtf3
; CHECK-NEXT: movaps %xmm0, vf128(%rip)
; CHECK: retq
}