diff mbox

[COMMITTED] powerpc: Fix encoding of POWER8 instruction

Message ID 54577B27.5010109@linux.vnet.ibm.com
State New
Headers show

Commit Message

Adhemerval Zanella Nov. 3, 2014, 12:55 p.m. UTC
This patch adds a binary encoding for 'mtvsrd' instruction to avoid
build failures when assembler does not support POWER8.

Checked on powerpc64 and powerpc64le.

--

	* sysdeps/powerpc/powerpc64/power8/memset.S (MTVSRD_V1_R4): Encode
	mtvsrd instruction in binary form.

---

Comments

Segher Boessenkool Nov. 4, 2014, 3:14 a.m. UTC | #1
On Mon, Nov 03, 2014 at 10:55:03AM -0200, Adhemerval Zanella wrote:
> +#include <endian.h>
> +
> +#if __BYTE_ORDER == __LITTLE_ENDIAN
> +#define MTVSRD_V1_R4  .byte 0x66,0x01,0x24,0x7c     /* mtvsrd  v1,r4  */
> +#else
> +#define MTVSRD_V1_R4  .byte 0x7c,0x24,0x01,0x66
> +#endif

Why not just

#define MTVSRD_V1_R4  .long 0x7c240166

(which works in any endianness)?


Segher
Adhemerval Zanella Nov. 4, 2014, 8:35 a.m. UTC | #2
On 04-11-2014 01:14, Segher Boessenkool wrote:
> On Mon, Nov 03, 2014 at 10:55:03AM -0200, Adhemerval Zanella wrote:
>> +#include <endian.h>
>> +
>> +#if __BYTE_ORDER == __LITTLE_ENDIAN
>> +#define MTVSRD_V1_R4  .byte 0x66,0x01,0x24,0x7c     /* mtvsrd  v1,r4  */
>> +#else
>> +#define MTVSRD_V1_R4  .byte 0x7c,0x24,0x01,0x66
>> +#endif
> Why not just
>
> #define MTVSRD_V1_R4  .long 0x7c240166
>
> (which works in any endianness)?



I was not aware '.long' work in any endianess. I will change it, thanks.
diff mbox

Patch

diff --git a/sysdeps/powerpc/powerpc64/power8/memset.S b/sysdeps/powerpc/powerpc64/power8/memset.S
index 191a4df..cebcbdf 100644
--- a/sysdeps/powerpc/powerpc64/power8/memset.S
+++ b/sysdeps/powerpc/powerpc64/power8/memset.S
@@ -17,6 +17,13 @@ 
    <http://www.gnu.org/licenses/>.  */
 
 #include <sysdep.h>
+#include <endian.h>
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define MTVSRD_V1_R4  .byte 0x66,0x01,0x24,0x7c     /* mtvsrd  v1,r4  */
+#else
+#define MTVSRD_V1_R4  .byte 0x7c,0x24,0x01,0x66
+#endif
 
 /* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5]));
    Returns 's'.  */
@@ -142,7 +149,7 @@  L(tail_bytes):
 	   vector instruction to achieve best throughput.  */
 L(huge_vector):
 	/* Replicate set byte to quadword in VMX register.  */
-	mtvsrd	 v1,r4
+	MTVSRD_V1_R4
 	xxpermdi 32,v0,v1,0
 	vspltb	 v2,v0,15