diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2013-05-06 16:17:29 +0000 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2013-05-06 16:17:29 +0000 |
commit | b503b49b5105b6aad7d2a015468b84b0f64dfe8e (patch) | |
tree | a60966043fae51838cb2faa08531a7ed078e4fb6 /test/CodeGen/SystemZ/fp-copysign-01.ll | |
parent | 1d09d56fe1e3f3faadd4bf4ccf3e585ddb3c3b07 (diff) | |
download | llvm-b503b49b5105b6aad7d2a015468b84b0f64dfe8e.tar.gz llvm-b503b49b5105b6aad7d2a015468b84b0f64dfe8e.tar.bz2 llvm-b503b49b5105b6aad7d2a015468b84b0f64dfe8e.tar.xz |
[SystemZ] Add CodeGen test cases
This adds all CodeGen tests for the SystemZ target.
This version of the patch incorporates feedback from a review by
Sean Silva. Thanks to all reviewers!
Patch by Richard Sandiford.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181204 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/SystemZ/fp-copysign-01.ll')
-rw-r--r-- | test/CodeGen/SystemZ/fp-copysign-01.ll | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/test/CodeGen/SystemZ/fp-copysign-01.ll b/test/CodeGen/SystemZ/fp-copysign-01.ll new file mode 100644 index 0000000000..458d475bdf --- /dev/null +++ b/test/CodeGen/SystemZ/fp-copysign-01.ll @@ -0,0 +1,128 @@ +; Test copysign operations. +; +; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s + +declare float @copysignf(float, float) readnone +declare double @copysign(double, double) readnone +; FIXME: not really the correct prototype for SystemZ. +declare fp128 @copysignl(fp128, fp128) readnone + +; Test f32 copies in which the sign comes from an f32. +define float @f1(float %a, float %b) { +; CHECK: f1: +; CHECK-NOT: %f2 +; CHECK: cpsdr %f0, %f0, %f2 +; CHECK: br %r14 + %res = call float @copysignf(float %a, float %b) readnone + ret float %res +} + +; Test f32 copies in which the sign comes from an f64. +define float @f2(float %a, double %bd) { +; CHECK: f2: +; CHECK-NOT: %f2 +; CHECK: cpsdr %f0, %f0, %f2 +; CHECK: br %r14 + %b = fptrunc double %bd to float + %res = call float @copysignf(float %a, float %b) readnone + ret float %res +} + +; Test f32 copies in which the sign comes from an f128. +define float @f3(float %a, fp128 *%bptr) { +; CHECK: f3: +; CHECK: ld [[BHIGH:%f[0-7]]], 0(%r2) +; CHECK: ld [[BLOW:%f[0-7]]], 8(%r2) +; CHECK: cpsdr %f0, %f0, [[BHIGH]] +; CHECK: br %r14 + %bl = load volatile fp128 *%bptr + %b = fptrunc fp128 %bl to float + %res = call float @copysignf(float %a, float %b) readnone + ret float %res +} + +; Test f64 copies in which the sign comes from an f32. +define double @f4(double %a, float %bf) { +; CHECK: f4: +; CHECK-NOT: %f2 +; CHECK: cpsdr %f0, %f0, %f2 +; CHECK: br %r14 + %b = fpext float %bf to double + %res = call double @copysign(double %a, double %b) readnone + ret double %res +} + +; Test f64 copies in which the sign comes from an f64. +define double @f5(double %a, double %b) { +; CHECK: f5: +; CHECK-NOT: %f2 +; CHECK: cpsdr %f0, %f0, %f2 +; CHECK: br %r14 + %res = call double @copysign(double %a, double %b) readnone + ret double %res +} + +; Test f64 copies in which the sign comes from an f128. +define double @f6(double %a, fp128 *%bptr) { +; CHECK: f6: +; CHECK: ld [[BHIGH:%f[0-7]]], 0(%r2) +; CHECK: ld [[BLOW:%f[0-7]]], 8(%r2) +; CHECK: cpsdr %f0, %f0, [[BHIGH]] +; CHECK: br %r14 + %bl = load volatile fp128 *%bptr + %b = fptrunc fp128 %bl to double + %res = call double @copysign(double %a, double %b) readnone + ret double %res +} + +; Test f128 copies in which the sign comes from an f32. We shouldn't +; need any register shuffling here; %a should be tied to %c, with CPSDR +; just changing the high register. +define void @f7(fp128 *%cptr, fp128 *%aptr, float %bf) { +; CHECK: f7: +; CHECK: ld [[AHIGH:%f[0-7]]], 0(%r3) +; CHECK: ld [[ALOW:%f[0-7]]], 8(%r3) +; CHECK: cpsdr [[AHIGH]], [[AHIGH]], %f0 +; CHECK: std [[AHIGH]], 0(%r2) +; CHECK: std [[ALOW]], 8(%r2) +; CHECK: br %r14 + %a = load volatile fp128 *%aptr + %b = fpext float %bf to fp128 + %c = call fp128 @copysignl(fp128 %a, fp128 %b) readnone + store fp128 %c, fp128 *%cptr + ret void +} + +; As above, but the sign comes from an f64. +define void @f8(fp128 *%cptr, fp128 *%aptr, double %bd) { +; CHECK: f8: +; CHECK: ld [[AHIGH:%f[0-7]]], 0(%r3) +; CHECK: ld [[ALOW:%f[0-7]]], 8(%r3) +; CHECK: cpsdr [[AHIGH]], [[AHIGH]], %f0 +; CHECK: std [[AHIGH]], 0(%r2) +; CHECK: std [[ALOW]], 8(%r2) +; CHECK: br %r14 + %a = load volatile fp128 *%aptr + %b = fpext double %bd to fp128 + %c = call fp128 @copysignl(fp128 %a, fp128 %b) readnone + store fp128 %c, fp128 *%cptr + ret void +} + +; As above, but the sign comes from an f128. Don't require the low part +; of %b to be loaded, since it isn't used. +define void @f9(fp128 *%cptr, fp128 *%aptr, fp128 *%bptr) { +; CHECK: f9: +; CHECK: ld [[AHIGH:%f[0-7]]], 0(%r3) +; CHECK: ld [[ALOW:%f[0-7]]], 8(%r3) +; CHECK: ld [[BHIGH:%f[0-7]]], 0(%r4) +; CHECK: cpsdr [[AHIGH]], [[AHIGH]], [[BHIGH]] +; CHECK: std [[AHIGH]], 0(%r2) +; CHECK: std [[ALOW]], 8(%r2) +; CHECK: br %r14 + %a = load volatile fp128 *%aptr + %b = load volatile fp128 *%bptr + %c = call fp128 @copysignl(fp128 %a, fp128 %b) readnone + store fp128 %c, fp128 *%cptr + ret void +} |