This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[ARM] __builtin_arm_setwcx patch
- From: Ben Elliston <bje at wasabisystems dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: nickc at redhat dot com
- Date: 30 Jan 2004 18:06:42 +1100
- Subject: [ARM] __builtin_arm_setwcx patch
Two days ago, Nick Clifton committed the following patch:
2004-01-28 Nick Clifton <nickc@redhat.com>
* config/arm/arm.c (arm_expand_builtin): Force second argument of
the setcwx insn into a register.
My patch correct this patch slightly such that the first argument (the
"value") is forced into a register and the register number is passed
second. This was discovered by way of a testsuite that was run
against a reference compiler.
Okay to commit?
2004-01-30 Ben Elliston <bje@wasabisystems.com>
* config/arm/mmintrin.h (_mm_setwcx): Reverse arguments in call to
__builtin_arm_setwcx ().
* config/arm/arm.c (arm_expand_builtin): Generate operands
correctly and reverse their order in call to gen_iwmmxt_tmcr ().
Index: arm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.323
diff -u -p -r1.323 arm.c
--- arm.c 28 Jan 2004 11:41:38 -0000 1.323
+++ arm.c 30 Jan 2004 06:58:00 -0000
@@ -11265,9 +11266,9 @@ arm_expand_builtin (tree exp,
case ARM_BUILTIN_SETWCX:
arg0 = TREE_VALUE (arglist);
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
- op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
- op1 = force_reg (SImode, expand_expr (arg1, NULL_RTX, VOIDmode, 0));
- emit_insn (gen_iwmmxt_tmcr (op0, op1));
+ op0 = force_reg (SImode, expand_expr (arg0, NULL_RTX, VOIDmode, 0));
+ op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
+ emit_insn (gen_iwmmxt_tmcr (op1, op0));
return 0;
case ARM_BUILTIN_GETWCX:
Index: mmintrin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/mmintrin.h,v
retrieving revision 1.1
diff -u -p -r1.1 mmintrin.h
--- mmintrin.h 18 Jun 2003 16:36:13 -0000 1.1
+++ mmintrin.h 30 Jan 2004 06:58:06 -0000
@@ -986,18 +986,18 @@ _mm_setzero_si64 (void)
the rest are reserved. */
static __inline void
-_mm_setwcx (const int __regno, const int __value)
+_mm_setwcx (const int __value, const int __regno)
{
switch (__regno)
{
- case 0: __builtin_arm_setwcx (0, __value); break;
- case 1: __builtin_arm_setwcx (1, __value); break;
- case 2: __builtin_arm_setwcx (2, __value); break;
- case 3: __builtin_arm_setwcx (3, __value); break;
- case 8: __builtin_arm_setwcx (8, __value); break;
- case 9: __builtin_arm_setwcx (9, __value); break;
- case 10: __builtin_arm_setwcx (10, __value); break;
- case 11: __builtin_arm_setwcx (11, __value); break;
+ case 0: __builtin_arm_setwcx (__value, 0); break;
+ case 1: __builtin_arm_setwcx (__value, 1); break;
+ case 2: __builtin_arm_setwcx (__value, 2); break;
+ case 3: __builtin_arm_setwcx (__value, 3); break;
+ case 8: __builtin_arm_setwcx (__value, 8); break;
+ case 9: __builtin_arm_setwcx (__value, 9); break;
+ case 10: __builtin_arm_setwcx (__value, 10); break;
+ case 11: __builtin_arm_setwcx (__value, 11); break;
default: break;
}
}