S390: Fix _FPU_SETCW/GETCW when compiling with Clang [BZ #30130]

Message ID 877cw2rm61.fsf@li-07e5db4c-3052-11b2-a85c-815382633c95.ibm.com
State Committed
Commit 3862773e1efba89ac7da43be80e64140b073c4e2
Headers
Series S390: Fix _FPU_SETCW/GETCW when compiling with Clang [BZ #30130] |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Andreas Arnez Feb. 28, 2023, 12:48 p.m. UTC
  The _FPU_SETCW and _FPU_GETCW macros are defined with inline assemblies.
They use the sfpc and efpc instructions, respectively.  But both contain
a spurious second operand that leads to a compile error with Clang.
Removing this operand works both with gcc/gas (since binutils 2.18) as
well as with clang/llvm.
---
 sysdeps/s390/fpu/fpu_control.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Stefan Liebler Feb. 28, 2023, 1:05 p.m. UTC | #1
On 28.02.23 13:48, Andreas Arnez wrote:
> The _FPU_SETCW and _FPU_GETCW macros are defined with inline assemblies.
> They use the sfpc and efpc instructions, respectively.  But both contain
> a spurious second operand that leads to a compile error with Clang.
> Removing this operand works both with gcc/gas (since binutils 2.18) as
> well as with clang/llvm.
> ---
>  sysdeps/s390/fpu/fpu_control.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sysdeps/s390/fpu/fpu_control.h b/sysdeps/s390/fpu/fpu_control.h
> index e00d7775f4..567b180034 100644
> --- a/sysdeps/s390/fpu/fpu_control.h
> +++ b/sysdeps/s390/fpu/fpu_control.h
> @@ -32,8 +32,8 @@
>  typedef unsigned int fpu_control_t;
>  
>  /* Macros for accessing the hardware control word.  */
> -#define _FPU_GETCW(cw)  __asm__ __volatile__ ("efpc %0,0" : "=d" (cw))
> -#define _FPU_SETCW(cw)  __asm__ __volatile__ ("sfpc  %0,0" : : "d" (cw))
> +#define _FPU_GETCW(cw)  __asm__ __volatile__ ("efpc %0" : "=d" (cw))
> +#define _FPU_SETCW(cw)  __asm__ __volatile__ ("sfpc %0" : : "d" (cw))
>  
>  /* Default control word set at startup.  */
>  extern fpu_control_t __fpu_control;

As mentioned in the bugzilla. This patch is fine. I've just committed it
and closed the bugzilla.

Thanks,
Stefan
  

Patch

diff --git a/sysdeps/s390/fpu/fpu_control.h b/sysdeps/s390/fpu/fpu_control.h
index e00d7775f4..567b180034 100644
--- a/sysdeps/s390/fpu/fpu_control.h
+++ b/sysdeps/s390/fpu/fpu_control.h
@@ -32,8 +32,8 @@ 
 typedef unsigned int fpu_control_t;
 
 /* Macros for accessing the hardware control word.  */
-#define _FPU_GETCW(cw)  __asm__ __volatile__ ("efpc %0,0" : "=d" (cw))
-#define _FPU_SETCW(cw)  __asm__ __volatile__ ("sfpc  %0,0" : : "d" (cw))
+#define _FPU_GETCW(cw)  __asm__ __volatile__ ("efpc %0" : "=d" (cw))
+#define _FPU_SETCW(cw)  __asm__ __volatile__ ("sfpc %0" : : "d" (cw))
 
 /* Default control word set at startup.  */
 extern fpu_control_t __fpu_control;