IBM Z: Test long doubles in vector registers

gcc/testsuite/ChangeLog:

2020-11-05  Ilya Leoshkevich  <iii@linux.ibm.com>

	* gcc.target/s390/vector/long-double-callee-abi-scan.c: New test.
	* gcc.target/s390/vector/long-double-caller-abi-run.c: New test.
	* gcc.target/s390/vector/long-double-caller-abi-scan.c: New test.
	* gcc.target/s390/vector/long-double-copysign.c: New test.
	* gcc.target/s390/vector/long-double-fprx2-constant.c: New test.
	* gcc.target/s390/vector/long-double-from-double.c: New test.
	* gcc.target/s390/vector/long-double-from-float.c: New test.
	* gcc.target/s390/vector/long-double-from-i16.c: New test.
	* gcc.target/s390/vector/long-double-from-i32.c: New test.
	* gcc.target/s390/vector/long-double-from-i64.c: New test.
	* gcc.target/s390/vector/long-double-from-i8.c: New test.
	* gcc.target/s390/vector/long-double-from-u16.c: New test.
	* gcc.target/s390/vector/long-double-from-u32.c: New test.
	* gcc.target/s390/vector/long-double-from-u64.c: New test.
	* gcc.target/s390/vector/long-double-from-u8.c: New test.
	* gcc.target/s390/vector/long-double-to-double.c: New test.
	* gcc.target/s390/vector/long-double-to-float.c: New test.
	* gcc.target/s390/vector/long-double-to-i16.c: New test.
	* gcc.target/s390/vector/long-double-to-i32.c: New test.
	* gcc.target/s390/vector/long-double-to-i64.c: New test.
	* gcc.target/s390/vector/long-double-to-i8.c: New test.
	* gcc.target/s390/vector/long-double-to-u16.c: New test.
	* gcc.target/s390/vector/long-double-to-u32.c: New test.
	* gcc.target/s390/vector/long-double-to-u64.c: New test.
	* gcc.target/s390/vector/long-double-to-u8.c: New test.
	* gcc.target/s390/vector/long-double-vec-duplicate.c: New test.
	* gcc.target/s390/vector/long-double-wf.h: New test.
	* gcc.target/s390/vector/long-double-wfaxb.c: New test.
	* gcc.target/s390/vector/long-double-wfcxb-0001.c: New test.
	* gcc.target/s390/vector/long-double-wfcxb-0111.c: New test.
	* gcc.target/s390/vector/long-double-wfcxb-1011.c: New test.
	* gcc.target/s390/vector/long-double-wfcxb-1101.c: New test.
	* gcc.target/s390/vector/long-double-wfdxb.c: New test.
	* gcc.target/s390/vector/long-double-wfixb.c: New test.
	* gcc.target/s390/vector/long-double-wfkxb-0111.c: New test.
	* gcc.target/s390/vector/long-double-wfkxb-1011.c: New test.
	* gcc.target/s390/vector/long-double-wfkxb-1101.c: New test.
	* gcc.target/s390/vector/long-double-wflcxb.c: New test.
	* gcc.target/s390/vector/long-double-wflpxb.c: New test.
	* gcc.target/s390/vector/long-double-wfmaxb-2.c: New test.
	* gcc.target/s390/vector/long-double-wfmaxb-3.c: New test.
	* gcc.target/s390/vector/long-double-wfmaxb-disabled.c: New test.
	* gcc.target/s390/vector/long-double-wfmaxb.c: New test.
	* gcc.target/s390/vector/long-double-wfmsxb-disabled.c: New test.
	* gcc.target/s390/vector/long-double-wfmsxb.c: New test.
	* gcc.target/s390/vector/long-double-wfmxb.c: New test.
	* gcc.target/s390/vector/long-double-wfnmaxb-disabled.c: New test.
	* gcc.target/s390/vector/long-double-wfnmaxb.c: New test.
	* gcc.target/s390/vector/long-double-wfnmsxb-disabled.c: New test.
	* gcc.target/s390/vector/long-double-wfnmsxb.c: New test.
	* gcc.target/s390/vector/long-double-wfsqxb.c: New test.
	* gcc.target/s390/vector/long-double-wfsxb-1.c: New test.
	* gcc.target/s390/vector/long-double-wfsxb.c: New test.
	* gcc.target/s390/vector/long-double-wftcixb-1.c: New test.
	* gcc.target/s390/vector/long-double-wftcixb.c: New test.
This commit is contained in:
Ilya Leoshkevich 2020-04-28 13:16:07 +02:00
parent e627cda568
commit cba3d03da6
55 changed files with 808 additions and 0 deletions

View file

@ -0,0 +1,20 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch -fno-unroll-loops" } */
#include <stdarg.h>
__attribute__ ((noipa, used)) long double
long_double_callee (long double x, int n, ...)
{
long double sum = x;
va_list vl;
int i;
va_start (vl, n);
for (i = 0; i < n; i++)
sum += va_arg (vl, long double);
va_end (vl);
return sum;
}
/* { dg-final { scan-assembler-times {\n\tvl\t} 3 } } */

View file

@ -0,0 +1,4 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-callee-abi-scan.c"
#include "long-double-caller-abi-scan.c"

View file

@ -0,0 +1,13 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include <assert.h>
long double long_double_callee (long double x, int n, ...);
int
main ()
{
assert (long_double_callee (1.L, 2, 2.L, 3.L) == 6.L);
}
/* { dg-final { scan-assembler-times {\n\tvst\t} 3 } } */

View file

@ -0,0 +1,21 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static long double
long_double_copysign (long double x, long double y)
{
return __builtin_copysignl (x, y);
}
/* { dg-final { scan-assembler-times {\n\tvsel\t} 1 } } */
int
main (void)
{
assert (long_double_copysign (1.1L, 2.2L) == 1.1L);
assert (long_double_copysign (1.1L, -2.2L) == -1.1L);
assert (long_double_copysign (-1.1L, 2.2L) == 1.1L);
assert (long_double_copysign (-1.1L, -2.2L) == -1.1L);
}

View file

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mtune=z14 -funroll-loops" } */
long double a;
int d;
void
b ()
{
for (int c = 0; c < d; ++c)
a = (a - c) / (c + 1);
}

View file

@ -0,0 +1,18 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
__attribute__ ((noipa)) static long double
long_double_from_double (double x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\twflld\t} 1 } } */
int
main (void)
{
assert (long_double_from_double (42.) == 42.L);
assert (long_double_from_double (-42.) == -42.L);
}

View file

@ -0,0 +1,19 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
__attribute__ ((noipa)) static long double
long_double_from_float (float x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tldebr\t} 1 } } */
/* { dg-final { scan-assembler-times {\n\twflld\t} 1 } } */
int
main (void)
{
assert (long_double_from_float (42.F) == 42.L);
assert (long_double_from_float (-42.F) == -42.L);
}

View file

@ -0,0 +1,19 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static long double
long_double_from_i16 (int16_t x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tcxfbr\t} 1 } } */
int
main (void)
{
assert (long_double_from_i16 (42) == 42.L);
assert (long_double_from_i16 (-42) == -42.L);
}

View file

@ -0,0 +1,19 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static long double
long_double_from_i32 (int32_t x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tcxfbr\t} 1 } } */
int
main (void)
{
assert (long_double_from_i32 (42) == 42.L);
assert (long_double_from_i32 (-42) == -42.L);
}

View file

@ -0,0 +1,19 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static long double
long_double_from_i64 (int64_t x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tcxgbr\t} 1 } } */
int
main (void)
{
assert (long_double_from_i64 (42) == 42.L);
assert (long_double_from_i64 (-42) == -42.L);
}

View file

@ -0,0 +1,19 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static long double
long_double_from_i8 (int8_t x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tcxfbr\t} 1 } } */
int
main (void)
{
assert (long_double_from_i8 (42) == 42.L);
assert (long_double_from_i8 (-42) == -42.L);
}

View file

@ -0,0 +1,19 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static long double
long_double_from_u16 (uint16_t x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tcxlfbr\t} 1 } } */
int
main (void)
{
assert (long_double_from_u16 (42) == 42.L);
assert (long_double_from_u16 (-42) == 65494.L);
}

View file

@ -0,0 +1,19 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static long double
long_double_from_u32 (uint32_t x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tcxlfbr\t} 1 } } */
int
main (void)
{
assert (long_double_from_u32 (42) == 42.L);
assert (long_double_from_u32 (-42) == 4294967254.L);
}

View file

@ -0,0 +1,19 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static long double
long_double_from_u64 (uint64_t x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tcxlgbr\t} 1 } } */
int
main (void)
{
assert (long_double_from_u64 (42) == 42.L);
assert (long_double_from_u64 (-42) == 18446744073709551574.L);
}

View file

@ -0,0 +1,19 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static long double
long_double_from_u8 (uint8_t x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tcxlfbr\t} 1 } } */
int
main (void)
{
assert (long_double_from_u8 (42) == 42.L);
assert (long_double_from_u8 (-42) == 214.L);
}

View file

@ -0,0 +1,18 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
__attribute__ ((noipa)) static double
long_double_to_double (long double x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\twflrx\t} 1 } } */
int
main (void)
{
assert (long_double_to_double (42.L) == 42.);
assert (long_double_to_double (-42.L) == -42.);
}

View file

@ -0,0 +1,19 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
__attribute__ ((noipa)) static float
long_double_to_float (long double x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\twflrx\t%v\d+,%v\d+,0,3\n} 1 } } */
/* { dg-final { scan-assembler-times {\n\tledbr\t} 1 } } */
int
main (void)
{
assert (long_double_to_float (42.L) == 42.F);
assert (long_double_to_float (-42.L) == -42.F);
}

View file

@ -0,0 +1,19 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static int16_t
long_double_to_i16 (long double x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tcfxbr\t} 1 } } */
int
main (void)
{
assert (long_double_to_i16 (42.L) == 42);
assert (long_double_to_i16 (-42.L) == -42);
}

View file

@ -0,0 +1,19 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static int32_t
long_double_to_i32 (long double x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tcfxbr\t} 1 } } */
int
main (void)
{
assert (long_double_to_i32 (42.L) == 42);
assert (long_double_to_i32 (-42.L) == -42);
}

View file

@ -0,0 +1,21 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static int64_t
long_double_to_i64 (long double x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tvpdi\t%v\d+,%v\d+,%v\d+,1\n} 1 } } */
/* { dg-final { scan-assembler-times {\n\tvpdi\t%v\d+,%v\d+,%v\d+,5\n} 1 } } */
/* { dg-final { scan-assembler-times {\n\tcgxbr\t} 1 } } */
int
main (void)
{
assert (long_double_to_i64 (42.L) == 42);
assert (long_double_to_i64 (-42.L) == -42);
}

View file

@ -0,0 +1,19 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static int8_t
long_double_to_i8 (long double x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tcfxbr\t} 1 } } */
int
main (void)
{
assert (long_double_to_i8 (42.L) == 42);
assert (long_double_to_i8 (-42.L) == -42);
}

View file

@ -0,0 +1,20 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static uint16_t
long_double_to_u16 (long double x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tclfxbr\t} 1 } } */
int
main (void)
{
assert (long_double_to_u16 (42.L) == 42);
/* Not (-42 & 0xffff) due to loss of precision. */
assert (long_double_to_u16 (-42.L) == 0);
}

View file

@ -0,0 +1,20 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static uint32_t
long_double_to_u32 (long double x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tclfxbr\t} 1 } } */
int
main (void)
{
assert (long_double_to_u32 (42.L) == 42);
/* Not (-42 & 0xffffffff) due to loss of precision. */
assert (long_double_to_u32 (-42.L) == 0);
}

View file

@ -0,0 +1,20 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static uint64_t
long_double_to_u64 (long double x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tclgxbr\t} 1 } } */
int
main (void)
{
assert (long_double_to_u64 (42.L) == 42);
/* Not (-42 & 0xffffffffffffffff) due to loss of precision. */
assert (long_double_to_u64 (-42.L) == 0);
}

View file

@ -0,0 +1,20 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
#include <stdint.h>
__attribute__ ((noipa)) static uint8_t
long_double_to_u8 (long double x)
{
return x;
}
/* { dg-final { scan-assembler-times {\n\tclfxbr\t} 1 } } */
int
main (void)
{
assert (long_double_to_u8 (42.L) == 42);
/* Not (-42 & 0xff) due to loss of precision. */
assert (long_double_to_u8 (-42.L) == 0);
}

View file

@ -0,0 +1,13 @@
/* { dg-do compile } */
/* { dg-options "-O3 -funroll-loops -march=z14 -mtune=z14" } */
long double a, b;
double *c;
long double *d;
void
e ()
{
while (d != &a)
*d++ = b * *c++;
}

View file

@ -0,0 +1,60 @@
#ifndef LONG_DOUBLE_WF_H
#define LONG_DOUBLE_WF_H 1
#include <math.h>
#define ADD(x, y, z) ((x) + (z))
#define DIV(x, y, z) ((x) / (z))
#define FABSL(x, y, z) (fabsl (y))
#define ISINFL(x, y, z) (isinfl (x) ? (y) : (z))
#define MUL(x, y, z) ((x) * (z))
#define MUL_ADD(x, y, z) ((x) * (y) + (z))
#define MUL_SUB(x, y, z) ((x) * (y) - (z))
#define NEG(x, y, z) \
({ \
volatile long double r = -(y); \
r; \
})
#define NEG_MUL_ADD(x, y, z) NEG (0, MUL_ADD (x, y, z), 0)
#define NEG_MUL_SUB(x, y, z) NEG (0, MUL_SUB (x, y, z), 0)
#define QUIET_IFEQUAL(x, y, z) ((x) == (y) ? (z) : 0)
#define QUIET_IFGREATER(x, y, z) (__builtin_isgreater (x, y) ? (z) : 0)
#define QUIET_IFLESS(x, y, z) (__builtin_isless (x, y) ? (z) : 0)
#define QUIET_IFUNORDERED(x, y, z) (__builtin_isunordered (x, y) ? (z) : 0)
#define SIGNALING_IFEQUAL(x, y, z) (((x) >= (y) && (x) <= (y)) ? (z) : 0)
#define SIGNALING_IFGREATER(x, y, z) ((x) > (y) ? (z) : 0)
#define SIGNALING_IFLESS(x, y, z) ((x) < (y) ? (z) : 0)
#define ROUNDL(x, y, z) (roundl (y))
#define SQRTL(x, y, z) (sqrtl (y))
#define SUB(x, y, z) ((x) - (z))
#define LONG_DOUBLE_WF(op) \
long double test ( \
long double x0, long double x1, long double x2, long double x3, \
long double x4, long double x5, long double x6, long double x7, \
long double x8, long double x9, long double x10, long double x11, \
long double x12, long double x13, long double x14, long double x15) \
{ \
while (x15 < 1E+30) \
{ \
x0 = op (x1, x2, x3); \
x1 = op (x2, x3, x4) + 1; \
x2 = op (x3, x4, x5) + 2; \
x3 = op (x4, x5, x6) + 3; \
x4 = op (x5, x6, x7) + 4; \
x5 = op (x6, x7, x8) + 5; \
x6 = op (x7, x8, x9) + 6; \
x7 = op (x8, x9, x10) + 7; \
x8 = op (x9, x10, x11) + 8; \
x9 = op (x10, x11, x12) + 9; \
x10 = op (x11, x12, x13) + 10; \
x11 = op (x12, x13, x14) + 11; \
x12 = op (x13, x14, x15) + 12; \
x13 = op (x14, x15, x0) + 13; \
x14 = op (x15, x0, x1) + 14; \
x15 = op (x0, x1, x2) + 15; \
} \
return x15; \
}
#endif

View file

@ -0,0 +1,17 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
__attribute__ ((noipa)) static long double
wfaxb (long double x, long double y, long double z)
{
return x + y + z;
}
/* { dg-final { scan-assembler-times {\n\twfaxb\t} 2 } } */
int
main (void)
{
assert (wfaxb (1.11L, 2.22L, 3.33L) == 6.66L);
}

View file

@ -0,0 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (QUIET_IFUNORDERED);
/* { dg-final { scan-assembler {\n\twfcxb\t} } } */
/* jo == brc 0b0001, ... */
/* { dg-final { scan-assembler {\n\tjo\t} } } */

View file

@ -0,0 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (QUIET_IFEQUAL);
/* { dg-final { scan-assembler {\n\twfcxb\t} } } */
/* jne == brc 0b0111, ... */
/* { dg-final { scan-assembler {\n\tjne\t} } } */

View file

@ -0,0 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (QUIET_IFLESS);
/* { dg-final { scan-assembler {\n\twfcxb\t} } } */
/* jnl == brc 0b1011, ... */
/* { dg-final { scan-assembler {\n\tjnl\t} } } */

View file

@ -0,0 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (QUIET_IFGREATER);
/* { dg-final { scan-assembler {\n\twfcxb\t} } } */
/* jnh == brc 0b1101, ... */
/* { dg-final { scan-assembler {\n\tjnh\t} } } */

View file

@ -0,0 +1,17 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
#include <assert.h>
__attribute__ ((noipa)) static long double
wfdxb (long double x, long double y, long double z)
{
return (x / y) / z;
}
/* { dg-final { scan-assembler-times {\n\twfdxb\t} 2 } } */
int
main (void)
{
assert (wfdxb (2.22L, 1.11L, 2.L) == 1.L);
}

View file

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (ROUNDL);
/* { dg-final { scan-assembler {\n\twfixb\t} } } */

View file

@ -0,0 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (SIGNALING_IFEQUAL);
/* { dg-final { scan-assembler {\n\twfkxb\t} } } */
/* jne == brc 0b0111, ... */
/* { dg-final { scan-assembler {\n\tjne\t} } } */

View file

@ -0,0 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (SIGNALING_IFLESS);
/* { dg-final { scan-assembler {\n\twfkxb\t} } } */
/* jnl == brc 0b1011, ... */
/* { dg-final { scan-assembler {\n\tjnl\t} } } */

View file

@ -0,0 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (SIGNALING_IFGREATER);
/* { dg-final { scan-assembler {\n\twfkxb\t} } } */
/* jnh == brc 0b1101, ... */
/* { dg-final { scan-assembler {\n\tjnh\t} } } */

View file

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (NEG);
/* { dg-final { scan-assembler {\n\twflcxb\t} } } */

View file

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (FABSL);
/* { dg-final { scan-assembler {\n\twflpxb\t} } } */

View file

@ -0,0 +1,24 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch -mvx-long-double-fma" } */
int a, c, d, f, k, l, m;
long double b, e, g, h, i;
double j;
void
n (void)
{
while (m)
{
a = b * d;
b = c;
c = d * e + 2;
e = f + g + 4;
f = h + 6;
g = h * 0 + i + 7;
h = i + 9;
i = j * k + 0 + 10;
j = l;
m = a * b;
}
}

View file

@ -0,0 +1,14 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch -mvx-long-double-fma" } */
long double a, c, d;
int b;
void
e (void)
{
while (d)
{
a = 0 * c + 0;
d = b;
}
}

View file

@ -0,0 +1,8 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (MUL_ADD);
/* { dg-final { scan-assembler {\n\twfmxb\t} } } */
/* { dg-final { scan-assembler {\n\twfaxb\t} } } */

View file

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch -mvx-long-double-fma" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (MUL_ADD);
/* { dg-final { scan-assembler {\n\twfmaxb\t} } } */

View file

@ -0,0 +1,8 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (MUL_SUB);
/* { dg-final { scan-assembler {\n\twfmxb\t} } } */
/* { dg-final { scan-assembler {\n\twfsxb\t} } } */

View file

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch -mvx-long-double-fma" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (MUL_SUB);
/* { dg-final { scan-assembler {\n\twfmsxb\t} } } */

View file

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (MUL);
/* { dg-final { scan-assembler {\n\twfmxb\t} } } */

View file

@ -0,0 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (NEG_MUL_ADD);
/* { dg-final { scan-assembler {\n\twfmxb\t} } } */
/* { dg-final { scan-assembler {\n\twfaxb\t} } } */
/* { dg-final { scan-assembler {\n\twflcxb\t} } } */

View file

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch -mvx-long-double-fma" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (NEG_MUL_ADD);
/* { dg-final { scan-assembler {\n\twfnmaxb\t} } } */

View file

@ -0,0 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (NEG_MUL_SUB);
/* { dg-final { scan-assembler {\n\twfmxb\t} } } */
/* { dg-final { scan-assembler {\n\twfsxb\t} } } */
/* { dg-final { scan-assembler {\n\twflcxb\t} } } */

View file

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch -mvx-long-double-fma" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (NEG_MUL_SUB);
/* { dg-final { scan-assembler {\n\twfnmsxb\t} } } */

View file

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (SQRTL);
/* { dg-final { scan-assembler {\n\twfsqxb\t} } } */

View file

@ -0,0 +1,21 @@
/* { dg-do run } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include <assert.h>
typedef float tf __attribute__ ((mode (TF)));
static tf x;
static tf y;
__attribute__ ((noipa)) static tf
sub (void)
{
return x - y;
}
int
main (void)
{
x = 1.5L;
y = 2.5L;
assert (sub () == -1.0L);
}

View file

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (SUB);
/* { dg-final { scan-assembler {\n\twfsxb\t} } } */

View file

@ -0,0 +1,15 @@
/* { dg-do compile } */
/* { dg-options "-O1 -march=z14 -mzarch" } */
int a, b;
void
c (void)
{
long double d;
a = d;
if (__builtin_isinf (d))
b = 0;
}
/* { dg-final { scan-assembler {\n\twftcixb\t} } } */

View file

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=z14 -mzarch" } */
#include "long-double-wf.h"
LONG_DOUBLE_WF (ISINFL);
/* { dg-final { scan-assembler {\n\twftcixb\t} } } */