Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 1 | ; Test floating-point negation. |
| 2 | ; |
Ulrich Weigand | 49506d7 | 2015-05-05 19:28:34 +0000 | [diff] [blame] | 3 | ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s |
| 4 | ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 5 | |
| 6 | ; Test f32. |
| 7 | define float @f1(float %f) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 8 | ; CHECK-LABEL: f1: |
Jonas Paulsson | 1262932 | 2015-10-01 18:12:28 +0000 | [diff] [blame] | 9 | ; CHECK: lcdfr %f0, %f0 |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 10 | ; CHECK: br %r14 |
| 11 | %res = fsub float -0.0, %f |
| 12 | ret float %res |
| 13 | } |
| 14 | |
| 15 | ; Test f64. |
| 16 | define double @f2(double %f) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 17 | ; CHECK-LABEL: f2: |
Jonas Paulsson | 1262932 | 2015-10-01 18:12:28 +0000 | [diff] [blame] | 18 | ; CHECK: lcdfr %f0, %f0 |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 19 | ; CHECK: br %r14 |
| 20 | %res = fsub double -0.0, %f |
| 21 | ret double %res |
| 22 | } |
| 23 | |
| 24 | ; Test f128. With the loads and stores, a pure negation would probably |
| 25 | ; be better implemented using an XI on the upper byte. Do some extra |
| 26 | ; processing so that using FPRs is unequivocally better. |
| 27 | define void @f3(fp128 *%ptr, fp128 *%ptr2) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 28 | ; CHECK-LABEL: f3: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 29 | ; CHECK: lcxbr |
| 30 | ; CHECK: dxbr |
| 31 | ; CHECK: br %r14 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 32 | %orig = load fp128 , fp128 *%ptr |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 33 | %negzero = fpext float -0.0 to fp128 |
| 34 | %neg = fsub fp128 0xL00000000000000008000000000000000, %orig |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 35 | %op2 = load fp128 , fp128 *%ptr2 |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 36 | %res = fdiv fp128 %neg, %op2 |
| 37 | store fp128 %res, fp128 *%ptr |
| 38 | ret void |
| 39 | } |