From patchwork Fri Dec 19 22:13:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 4374 Received: (qmail 13657 invoked by alias); 19 Dec 2014 22:13:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 13648 invoked by uid 89); 19 Dec 2014 22:13:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mailapp01.imgtec.com From: "Steve Ellcey " Date: Fri, 19 Dec 2014 14:13:29 -0800 To: Subject: [Patch, MIPS] Modify PTR_* macros for mips32r6/mips64r6 User-Agent: Heirloom mailx 12.5 6/20/10 MIME-Version: 1.0 Message-ID: <045e59a8-12b8-4203-bec9-5b86ade30cab@BAMAIL02.ba.imgtec.org> This patch modifies some PTR_* macro definitions for mips32r6 and mips64r6. It uses addu/subu instructions for pointer arithmetic as these operations do not trap on mips32r6/mips64r6 whereas the add/sub instructions do trap. Tested with the mips32r6/mips64r6 GCC, binutils and qemu simulator. OK to checkin? Steve Ellcey sellcey@imgtec.com 2014-12-19 Steve Ellcey * sysdeps/mips/sys/asm.h (PTR_ADDU): Use addu on mips32r6/mips64r6. (PTR_ADDIU): Use addiu for mips32r6/mips64r6. (PTR_SUBU): Use subu for mips32r6/mips64r6. (PTR_SUBIU): Use subu for mips32r6/mips64r6 (subiu does not exist). * sysdeps/mips/machine-gmon.h (PTR_ADDU_STRING) Use addu for mips32r6/mips64r6. (PTR_SUBU_STRING) Use subu for mips32r6/mips64r6. diff --git a/sysdeps/mips/machine-gmon.h b/sysdeps/mips/machine-gmon.h index aac1723..f5d1c64 100644 --- a/sysdeps/mips/machine-gmon.h +++ b/sysdeps/mips/machine-gmon.h @@ -83,8 +83,13 @@ static void __attribute_used__ __mcount (u_long frompc, u_long selfpc) #endif #if _MIPS_SIM == _ABIN32 -# define PTR_ADDU_STRING "add" /* no u */ -# define PTR_SUBU_STRING "sub" /* no u */ +# if __mips_isa_rev < 6 +# define PTR_ADDU_STRING "add" /* no u */ +# define PTR_SUBU_STRING "sub" /* no u */ +# else +# define PTR_ADDU_STRING "addu" +# define PTR_SUBU_STRING "subu" +# endif #elif _MIPS_SIM == _ABI64 # define PTR_ADDU_STRING "daddu" # define PTR_SUBU_STRING "dsubu" diff --git a/sysdeps/mips/sys/asm.h b/sysdeps/mips/sys/asm.h index e479e9b..a618d49 100644 --- a/sysdeps/mips/sys/asm.h +++ b/sysdeps/mips/sys/asm.h @@ -416,12 +416,19 @@ symbol = value #if _MIPS_SIM == _ABIN32 # define PTR_ADD add # define PTR_ADDI addi -# define PTR_ADDU add /* no u */ -# define PTR_ADDIU addi /* no u */ # define PTR_SUB sub # define PTR_SUBI subi +#if __mips_isa_rev < 6 +# define PTR_ADDU add /* no u */ +# define PTR_ADDIU addi /* no u */ # define PTR_SUBU sub /* no u */ # define PTR_SUBIU sub /* no u */ +#else +# define PTR_ADDU addu +# define PTR_ADDIU addiu +# define PTR_SUBU subu +# define PTR_SUBIU subu +#endif # define PTR_L lw # define PTR_LA la # define PTR_S sw