[PATCH] i386: Add _MM_FROUND_TIES_TO_EVEN to smmintrin.h

2024-07-20 Thread Paul Caprioli
Intrinsics such as `_mm512_add_round_ps` take a rounding mode argument to 
specify the floating point rounding mode. This and similar instructions do NOT 
round their result to an integer. Thus it is inappropriate for user code to 
specify the existing `_MM_FROUND_TO_NEAREST_INT` when desiring to round to the 
nearest floating point number. This patch adds a suitable macro definition.

Note that some few instructions, e.g., `ROUNDPS`, do round to an integer, so 
the existing macro definition ought not be deprecated.

Note that IEEE Std 754-2019 for floating-point arithmetic specifies two 
rounding direction attributes to nearest: `roundTiesToEven` and 
`roundTiesToAway`. Also, it specifies three directed rounding attributes: 
`roundTowardPositive`, `roundTowardNegative`, and `roundTowardZero`.

This patch follows that IEEE naming precedent.  As hardware correctly 
implements that IEEE rounding attribute, it seems best not to innovate in 
naming the macro

Please note that I do not have write access to the git repo and that I am not a 
member of this email alias.  Your adding p...@hpkfft.com to any discussions 
would be appreciated.

Regards,
Paul



From 0e2ceddffed88dab9cc459f7efcab2e36e1cb7e3 Mon Sep 17 00:00:00 2001
From: Paul Caprioli 
Date: Sat, 20 Jul 2024 11:31:06 -0700
Subject: [PATCH] Add _MM_FROUND_TIES_TO_EVEN to smmintrin.h

---
 gcc/config/i386/smmintrin.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/i386/smmintrin.h b/gcc/config/i386/smmintrin.h
index 4c315feec36..b194659ae06 100644
--- a/gcc/config/i386/smmintrin.h
+++ b/gcc/config/i386/smmintrin.h
@@ -39,6 +39,7 @@
 
 /* Rounding mode macros. */
 #define _MM_FROUND_TO_NEAREST_INT	0x00
+#define _MM_FROUND_TIES_TO_EVEN		0x00
 #define _MM_FROUND_TO_NEG_INF		0x01
 #define _MM_FROUND_TO_POS_INF		0x02
 #define _MM_FROUND_TO_ZERO		0x03
-- 
2.39.2



RE: [PATCH] i386: Add _MM_FROUND_TIES_TO_EVEN to smmintrin.h

2024-07-22 Thread Paul Caprioli
In response to feedback from LLVM/clang, I suggest naming the macro 
`_MM_FROUND_TO_NEAREST_TIES_EVEN`.
The updated patch is attached (and the previous one may be disregarded).


The clang PR is here: https://github.com/llvm/llvm-project/pull/99691

Regards,
Paul


-Original message-
From: Paul Caprioli
Sent: Saturday, July 20 2024, 12:01 pm
To: gcc-patches@gcc.gnu.org 
Subject: [PATCH] i386: Add _MM_FROUND_TIES_TO_EVEN to smmintrin.h

Intrinsics such as `_mm512_add_round_ps` take a rounding mode argument to 
specify the floating point rounding mode. This and similar instructions do NOT 
round their result to an integer. Thus it is inappropriate for user code to 
specify the existing `_MM_FROUND_TO_NEAREST_INT` when desiring to round to the 
nearest floating point number. This patch adds a suitable macro definition.

Note that some few instructions, e.g., `ROUNDPS`, do round to an integer, so 
the existing macro definition ought not be deprecated.

Note that IEEE Std 754-2019 for floating-point arithmetic specifies two 
rounding direction attributes to nearest: `roundTiesToEven` and 
`roundTiesToAway`. Also, it specifies three directed rounding attributes: 
`roundTowardPositive`, `roundTowardNegative`, and `roundTowardZero`.

This patch follows that IEEE naming precedent.  As hardware correctly 
implements that IEEE rounding attribute, it seems best not to innovate in 
naming the macro

Please note that I do not have write access to the git repo and that I am not a 
member of this email alias.  Your adding p...@hpkfft.com 
<mailto:p...@hpkfft.com> to any discussions would be appreciated.

Regards,
Paul

From ad12dbd202a8aa960dbbb5e23f8b990753d9ba7a Mon Sep 17 00:00:00 2001
From: Paul Caprioli 
Date: Sat, 20 Jul 2024 11:31:06 -0700
Subject: [PATCH] Add _MM_FROUND_TO_NEAREST_TIES_EVEN to smmintrin.h

---
 gcc/config/i386/smmintrin.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/i386/smmintrin.h b/gcc/config/i386/smmintrin.h
index 4c315feec36..22ef9e966a7 100644
--- a/gcc/config/i386/smmintrin.h
+++ b/gcc/config/i386/smmintrin.h
@@ -39,6 +39,7 @@
 
 /* Rounding mode macros. */
 #define _MM_FROUND_TO_NEAREST_INT	0x00
+#define _MM_FROUND_TO_NEAREST_TIES_EVEN	0x00
 #define _MM_FROUND_TO_NEG_INF		0x01
 #define _MM_FROUND_TO_POS_INF		0x02
 #define _MM_FROUND_TO_ZERO		0x03
-- 
2.39.2



RE: [PATCH] i386: Add _MM_FROUND_TO_NEAREST_TIES_EVEN to smmintrin.h

2024-09-04 Thread Paul Caprioli
Hi,

I'm writing to ask that someone with write access to the git repo apply 
this patch, which provides the macro definition 
`_MM_FROUND_TO_NEAREST_TIES_EVEN`.

Intrinsics such as `_mm512_add_round_ps` take a rounding mode argument to 
specify the floating point rounding mode. This and similar instructions do NOT 
round their result to an integer. Thus it is inappropriate for user code to 
specify the existing `_MM_FROUND_TO_NEAREST_INT` when desiring to round to the 
nearest floating point number. This patch adds a suitable macro definition.

Note that some few instructions, e.g., `ROUNDPS`, do round to an integer, 
so the existing macro definition ought not be deprecated.

Note that IEEE Std 754-2019 for floating-point arithmetic specifies two 
rounding direction attributes to nearest: `roundTiesToEven` and 
`roundTiesToAway`. Also, it specifies three directed rounding attributes: 
`roundTowardPositive`, `roundTowardNegative`, and `roundTowardZero`.

Please note that I do not have write access to the git repo and that I am 
not a member of this email alias.  Your adding p...@hpkfft.com 
<mailto:p...@hpkfft.com> to any discussions would be appreciated.

Regards,
Paul

From d35d67cb9d333f2d99b4ee18ec2156ad1b973487 Mon Sep 17 00:00:00 2001
From: Paul Caprioli 
Date: Sat, 20 Jul 2024 11:31:06 -0700
Subject: [PATCH] Add _MM_FROUND_TO_NEAREST_TIES_EVEN to smmintrin.h

---
 gcc/config/i386/smmintrin.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/i386/smmintrin.h b/gcc/config/i386/smmintrin.h
index 4c315feec36..22ef9e966a7 100644
--- a/gcc/config/i386/smmintrin.h
+++ b/gcc/config/i386/smmintrin.h
@@ -39,6 +39,7 @@
 
 /* Rounding mode macros. */
 #define _MM_FROUND_TO_NEAREST_INT	0x00
+#define _MM_FROUND_TO_NEAREST_TIES_EVEN	0x00
 #define _MM_FROUND_TO_NEG_INF		0x01
 #define _MM_FROUND_TO_POS_INF		0x02
 #define _MM_FROUND_TO_ZERO		0x03
-- 
2.39.2



RE: [PATCH] i386: Add _MM_FROUND_TO_NEAREST_TIES_EVEN to smmintrin.h

2024-10-26 Thread Paul Caprioli
This patch adds the standard macro definition _MM_FROUND_TO_NEAREST_TIES_EVEN 
for specifying the IEEE rounding to nearest attribute `roundTiesToEven` for 
AVX512 floating-point intrinsics.

More information can be found in the original email to this list
 https://gcc.gnu.org/pipermail/gcc-patches/2024-July/657957.html
and in the discussion
 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117163

Regards,
Paul
From d01a657a6bc138cfbf1953bbbf2976a0eed4c5c7 Mon Sep 17 00:00:00 2001
From: Paul Caprioli 
Date: Sat, 20 Jul 2024 11:31:06 -0700
Subject: [PATCH] Add _MM_FROUND_TO_NEAREST_TIES_EVEN to smmintrin.h

---
 gcc/config/i386/smmintrin.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/i386/smmintrin.h b/gcc/config/i386/smmintrin.h
index c2d82773247..1b732433453 100644
--- a/gcc/config/i386/smmintrin.h
+++ b/gcc/config/i386/smmintrin.h
@@ -39,6 +39,7 @@
 
 /* Rounding mode macros. */
 #define _MM_FROUND_TO_NEAREST_INT	0x00
+#define _MM_FROUND_TO_NEAREST_TIES_EVEN	0x00
 #define _MM_FROUND_TO_NEG_INF		0x01
 #define _MM_FROUND_TO_POS_INF		0x02
 #define _MM_FROUND_TO_ZERO		0x03
-- 
2.39.5



RE: [PATCH] i386: Add _MM_FROUND_TO_NEAREST_TIES_EVEN to smmintrin.h

2024-09-30 Thread Paul Caprioli

Hi,

I'm writing to ask that someone with write access to the git repo apply 
this patch, which provides the macro definition 
`_MM_FROUND_TO_NEAREST_TIES_EVEN`.

Intrinsics such as `_mm512_add_round_ps` take a rounding mode argument to 
specify the floating point rounding mode. This and similar instructions do NOT 
round their result to an integer. Thus it is inappropriate for user code to 
specify the existing `_MM_FROUND_TO_NEAREST_INT` when desiring to round to the 
nearest floating point number. This patch adds a suitable macro definition.

Note that some few instructions, e.g., `ROUNDPS`, do round to an integer, 
so the existing macro definition ought not be deprecated.

Note that IEEE Std 754-2019 for floating-point arithmetic specifies two 
rounding direction attributes to nearest: `roundTiesToEven` and 
`roundTiesToAway`. Also, it specifies three directed rounding attributes: 
`roundTowardPositive`, `roundTowardNegative`, and `roundTowardZero`.

Please note that I do not have write access to the git repo and that I am 
not a member of this email alias.  Your adding p...@hpkfft.com 
<mailto:p...@hpkfft.com> to any discussions would be appreciated.

Regards,
Paul

From c3f03dcd6a804a159c5789b44cb0ecac76439ee7 Mon Sep 17 00:00:00 2001
From: Paul Caprioli 
Date: Sat, 20 Jul 2024 11:31:06 -0700
Subject: [PATCH] Add _MM_FROUND_TO_NEAREST_TIES_EVEN to smmintrin.h

---
 gcc/config/i386/smmintrin.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/i386/smmintrin.h b/gcc/config/i386/smmintrin.h
index 4c315feec36..22ef9e966a7 100644
--- a/gcc/config/i386/smmintrin.h
+++ b/gcc/config/i386/smmintrin.h
@@ -39,6 +39,7 @@
 
 /* Rounding mode macros. */
 #define _MM_FROUND_TO_NEAREST_INT	0x00
+#define _MM_FROUND_TO_NEAREST_TIES_EVEN	0x00
 #define _MM_FROUND_TO_NEG_INF		0x01
 #define _MM_FROUND_TO_POS_INF		0x02
 #define _MM_FROUND_TO_ZERO		0x03
-- 
2.39.5