瀏覽代碼

s390x: add single instruction fma and fmaf

These are available in the s390x baseline isa -march=z900.
Szabolcs Nagy 6 年之前
父節點
當前提交
1da534ada8
共有 2 個文件被更改,包括 14 次插入0 次删除
  1. 7 0
      src/math/s390x/fma.c
  2. 7 0
      src/math/s390x/fmaf.c

+ 7 - 0
src/math/s390x/fma.c

@@ -0,0 +1,7 @@
+#include <math.h>
+
+double fma(double x, double y, double z)
+{
+	__asm__ ("madbr %0, %1, %2" : "+f"(z) : "f"(x), "f"(y));
+	return z;
+}

+ 7 - 0
src/math/s390x/fmaf.c

@@ -0,0 +1,7 @@
+#include <math.h>
+
+float fmaf(float x, float y, float z)
+{
+	__asm__ ("maebr %0, %1, %2" : "+f"(z) : "f"(x), "f"(y));
+	return z;
+}