[3/7,Arm] Add testsuite library support for PACBTI target.

Message ID AM5PR0801MB184459FF8D4A79457927F919EAB29@AM5PR0801MB1844.eurprd08.prod.outlook.com
State Superseded
Headers
Series [1/7,Arm] Add Armv8.1-M Mainline target feature +pacbti. |

Commit Message

Tejas Belagod Oct. 8, 2021, 12:17 p.m. UTC
  Hi,

Add targeting-checking entities for PACBTI in testsuite
framework.

Tested on arm-none-eabi. OK for trunk?

2021-10-04  Tejas Belagod  <tbelagod@arm.com>

gcc/ChangeLog:

	* testsuite/lib/target-supports.exp
	(check_effective_target_arm_pacbti_hw): New.
  

Comments

Richard Earnshaw (lists) Oct. 11, 2021, 1:36 p.m. UTC | #1
On 08/10/2021 13:17, Tejas Belagod via Gcc-patches wrote:
> Hi,
> 
> Add targeting-checking entities for PACBTI in testsuite
> framework.
> 
> Tested on arm-none-eabi. OK for trunk?
> 
> 2021-10-04  Tejas Belagod  <tbelagod@arm.com>
> 
> gcc/ChangeLog:
> 
> 	* testsuite/lib/target-supports.exp
> 	(check_effective_target_arm_pacbti_hw): New.
> 

OK.

R.
  
Richard Earnshaw (lists) Oct. 11, 2021, 1:38 p.m. UTC | #2
On 11/10/2021 14:36, Richard Earnshaw via Gcc-patches wrote:
> On 08/10/2021 13:17, Tejas Belagod via Gcc-patches wrote:
>> Hi,
>>
>> Add targeting-checking entities for PACBTI in testsuite
>> framework.
>>
>> Tested on arm-none-eabi. OK for trunk?
>>
>> 2021-10-04  Tejas Belagod  <tbelagod@arm.com>
>>
>> gcc/ChangeLog:
>>
>>     * testsuite/lib/target-supports.exp
>>     (check_effective_target_arm_pacbti_hw): New.
>>
> 
> OK.
> 
> R.

Oh, wait!  Not OK.  Needs documentation in sourcebuild.texi.

R.
  

Patch

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 9ebca7ac007363d2a35158bb80092118f629b97b..323541c2da527e3da5dce4d85cadcb2068d9bb5c 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5064,6 +5064,22 @@  proc check_effective_target_arm_cmse_clear_ok {} {
     } "-mcmse"];
 }
 
+# Return 1 if the target supports executing PACBTI instructions, 0
+# otherwise.
+
+proc check_effective_target_arm_pacbti_hw {} {
+    return [check_runtime arm_pacbti_hw_available {
+	__attribute__ ((naked)) int
+	main (void)
+	{
+	  asm ("pac r12, lr, sp");
+	  asm ("mov r0, #0");
+	  asm ("autg r12, lr, sp");
+	  asm ("bx lr");
+	}
+    } ""]
+}
+
 # Return 1 if this compilation turns on string_ops_prefer_neon on.
 
 proc check_effective_target_arm_tune_string_ops_prefer_neon { } {