From 87d9584ec29f9e5b0cffa5c8dc30a599142c8b30 Mon Sep 17 00:00:00 2001
From: David Edelsohn <dje.gcc@gmail.com>
Date: Tue, 20 Jun 2017 23:23:28 -0400
Subject: [PATCH 2/2] Add support for pre-z196 architecture.

---
 src/math/s390x/ceil.c       | 8 ++++++++
 src/math/s390x/ceilf.c      | 8 ++++++++
 src/math/s390x/ceill.c      | 8 ++++++++
 src/math/s390x/fabs.c       | 8 ++++++++
 src/math/s390x/fabsf.c      | 8 ++++++++
 src/math/s390x/fabsl.c      | 8 ++++++++
 src/math/s390x/floor.c      | 8 ++++++++
 src/math/s390x/floorf.c     | 8 ++++++++
 src/math/s390x/floorl.c     | 8 ++++++++
 src/math/s390x/nearbyint.c  | 8 ++++++++
 src/math/s390x/nearbyintf.c | 8 ++++++++
 src/math/s390x/nearbyintl.c | 8 ++++++++
 src/math/s390x/rint.c       | 8 ++++++++
 src/math/s390x/rintf.c      | 8 ++++++++
 src/math/s390x/rintl.c      | 8 ++++++++
 src/math/s390x/round.c      | 8 ++++++++
 src/math/s390x/roundf.c     | 8 ++++++++
 src/math/s390x/roundl.c     | 8 ++++++++
 src/math/s390x/sqrt.c       | 8 ++++++++
 src/math/s390x/sqrtf.c      | 8 ++++++++
 src/math/s390x/sqrtl.c      | 8 ++++++++
 src/math/s390x/trunc.c      | 8 ++++++++
 src/math/s390x/truncf.c     | 8 ++++++++
 src/math/s390x/truncl.c     | 8 ++++++++
 24 files changed, 192 insertions(+)

diff --git a/src/math/s390x/ceil.c b/src/math/s390x/ceil.c
index 2d0b422..9cfabec 100644
--- a/src/math/s390x/ceil.c
+++ b/src/math/s390x/ceil.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 double ceil(double x)
 {
 	__asm__ ("fidbra %0, 6, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../ceil.c"
+
+#endif
diff --git a/src/math/s390x/ceilf.c b/src/math/s390x/ceilf.c
index 94260e6..74dce68 100644
--- a/src/math/s390x/ceilf.c
+++ b/src/math/s390x/ceilf.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 float ceilf(float x)
 {
 	__asm__ ("fiebra %0, 6, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../ceilf.c"
+
+#endif
diff --git a/src/math/s390x/ceill.c b/src/math/s390x/ceill.c
index 2ee4a5b..abafa08 100644
--- a/src/math/s390x/ceill.c
+++ b/src/math/s390x/ceill.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 long double ceill(long double x)
 {
 	__asm__ ("fixbra %0, 6, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../ceill.c"
+
+#endif
diff --git a/src/math/s390x/fabs.c b/src/math/s390x/fabs.c
index 0c569a2..3ee2835 100644
--- a/src/math/s390x/fabs.c
+++ b/src/math/s390x/fabs.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 double fabs(double x)
 {
 	__asm__ ("lpdbr %0, %1" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../fabs.c"
+
+#endif
diff --git a/src/math/s390x/fabsf.c b/src/math/s390x/fabsf.c
index 99f884c..e0d9951 100644
--- a/src/math/s390x/fabsf.c
+++ b/src/math/s390x/fabsf.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 float fabsf(float x)
 {
 	__asm__ ("lpebr %0, %1" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../fabsf.c"
+
+#endif
diff --git a/src/math/s390x/fabsl.c b/src/math/s390x/fabsl.c
index f543ef0..2858182 100644
--- a/src/math/s390x/fabsl.c
+++ b/src/math/s390x/fabsl.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 long double fabsl(long double x)
 {
 	__asm__ ("lpxbr %0, %1" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../fabsl.c"
+
+#endif
diff --git a/src/math/s390x/floor.c b/src/math/s390x/floor.c
index d4958eb..626aea1 100644
--- a/src/math/s390x/floor.c
+++ b/src/math/s390x/floor.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 double floor(double x)
 {
 	__asm__ ("fidbra %0, 7, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../floor.c"
+
+#endif
diff --git a/src/math/s390x/floorf.c b/src/math/s390x/floorf.c
index af06471..5f4fc41 100644
--- a/src/math/s390x/floorf.c
+++ b/src/math/s390x/floorf.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 float floorf(float x)
 {
 	__asm__ ("fiebra %0, 7, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../floorf.c"
+
+#endif
diff --git a/src/math/s390x/floorl.c b/src/math/s390x/floorl.c
index 0df4be1..8411a3e 100644
--- a/src/math/s390x/floorl.c
+++ b/src/math/s390x/floorl.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 long double floorl(long double x)
 {
 	__asm__ ("fixbra %0, 7, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../floorl.c"
+
+#endif
diff --git a/src/math/s390x/nearbyint.c b/src/math/s390x/nearbyint.c
index 0d3359f..56dea06 100644
--- a/src/math/s390x/nearbyint.c
+++ b/src/math/s390x/nearbyint.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 double nearbyint(double x)
 {
 	__asm__ ("fidbra %0, 0, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../nearbyint.c"
+
+#endif
diff --git a/src/math/s390x/nearbyintf.c b/src/math/s390x/nearbyintf.c
index 3ad8695..6155adc 100644
--- a/src/math/s390x/nearbyintf.c
+++ b/src/math/s390x/nearbyintf.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 float nearbyintf(float x)
 {
 	__asm__ ("fiebra %0, 0, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../nearbyintf.c"
+
+#endif
diff --git a/src/math/s390x/nearbyintl.c b/src/math/s390x/nearbyintl.c
index 9d900f9..4e186e1 100644
--- a/src/math/s390x/nearbyintl.c
+++ b/src/math/s390x/nearbyintl.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 long double nearbyintl(long double x)
 {
 	__asm__ ("fixbra %0, 0, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../nearbyintl.c"
+
+#endif
diff --git a/src/math/s390x/rint.c b/src/math/s390x/rint.c
index bdd62b3..7f1f335 100644
--- a/src/math/s390x/rint.c
+++ b/src/math/s390x/rint.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 double rint(double x)
 {
 	__asm__ ("fidbr %0, 0, %1" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../rint.c"
+
+#endif
diff --git a/src/math/s390x/rintf.c b/src/math/s390x/rintf.c
index c1e98c5..17fd1fe 100644
--- a/src/math/s390x/rintf.c
+++ b/src/math/s390x/rintf.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 float rintf(float x)
 {
 	__asm__ ("fiebr %0, 0, %1" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../rintf.c"
+
+#endif
diff --git a/src/math/s390x/rintl.c b/src/math/s390x/rintl.c
index 4856825..d31e833 100644
--- a/src/math/s390x/rintl.c
+++ b/src/math/s390x/rintl.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 long double rintl(long double x)
 {
 	__asm__ ("fixbr %0, 0, %1" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../rintl.c"
+
+#endif
diff --git a/src/math/s390x/round.c b/src/math/s390x/round.c
index 10b3159..6ea6fdc 100644
--- a/src/math/s390x/round.c
+++ b/src/math/s390x/round.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 double round(double x)
 {
 	__asm__ ("fidbra %0, 1, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../round.c"
+
+#endif
diff --git a/src/math/s390x/roundf.c b/src/math/s390x/roundf.c
index 28758ce..43ea2c2 100644
--- a/src/math/s390x/roundf.c
+++ b/src/math/s390x/roundf.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 float roundf(float x)
 {
 	__asm__ ("fiebra %0, 1, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../roundf.c"
+
+#endif
diff --git a/src/math/s390x/roundl.c b/src/math/s390x/roundl.c
index deef38e..7f4d11d 100644
--- a/src/math/s390x/roundl.c
+++ b/src/math/s390x/roundl.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 long double roundl(long double x)
 {
 	__asm__ ("fixbra %0, 1, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../roundl.c"
+
+#endif
diff --git a/src/math/s390x/sqrt.c b/src/math/s390x/sqrt.c
index 7407a5c..e326b2c 100644
--- a/src/math/s390x/sqrt.c
+++ b/src/math/s390x/sqrt.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 double sqrt(double x)
 {
 	__asm__ ("sqdbr %0, %1" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../sqrt.c"
+
+#endif
diff --git a/src/math/s390x/sqrtf.c b/src/math/s390x/sqrtf.c
index fbfdf6a..65af7a9 100644
--- a/src/math/s390x/sqrtf.c
+++ b/src/math/s390x/sqrtf.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 float sqrtf(float x)
 {
 	__asm__ ("sqebr %0, %1" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../sqrtf.c"
+
+#endif
diff --git a/src/math/s390x/sqrtl.c b/src/math/s390x/sqrtl.c
index 9b14d67..4918b0b 100644
--- a/src/math/s390x/sqrtl.c
+++ b/src/math/s390x/sqrtl.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 long double sqrtl(long double x)
 {
 	__asm__ ("sqxbr %0, %1" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../sqrtl.c"
+
+#endif
diff --git a/src/math/s390x/trunc.c b/src/math/s390x/trunc.c
index 24d9ed7..4178ef0 100644
--- a/src/math/s390x/trunc.c
+++ b/src/math/s390x/trunc.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 double trunc(double x)
 {
 	__asm__ ("fidbra %0, 5, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../trunc.c"
+
+#endif
diff --git a/src/math/s390x/truncf.c b/src/math/s390x/truncf.c
index a59e52a..90b667e 100644
--- a/src/math/s390x/truncf.c
+++ b/src/math/s390x/truncf.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 float truncf(float x)
 {
 	__asm__ ("fiebra %0, 5, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../truncf.c"
+
+#endif
diff --git a/src/math/s390x/truncl.c b/src/math/s390x/truncl.c
index 98afa2d..9535114 100644
--- a/src/math/s390x/truncl.c
+++ b/src/math/s390x/truncl.c
@@ -1,7 +1,15 @@
 #include <math.h>
 
+#if defined (__HTM__) || __ARCH__ >= 9
+
 long double truncl(long double x)
 {
 	__asm__ ("fixbra %0, 5, %1, 4" : "=f"(x) : "f"(x));
 	return x;
 }
+
+#else
+
+#include "../truncl.c"
+
+#endif
-- 
1.8.3.1

