From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id 16DEB3858431 for ; Sat, 5 Nov 2022 12:30:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 16DEB3858431 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 5ECF030008C; Sat, 5 Nov 2022 12:30:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1667651405; bh=8oZplBGcTFLE5wd1vyeSO405IHCcSteCSYe+VP5Q5F8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Mime-Version:Content-Transfer-Encoding; b=IaURK/QWOz96H83X6Wkm9PxkW065NNdbvJdavEV4weoifh3wV+0zxnnJH/A7H0+1u p1kE5s/O3GOxqXboyJtNa+IR87h/CX4Y4/amZkPAK4l5TJrVtKOi+GodC5oetDqkL6 5Frq3jxZMVgJ7lPXERWXuvdrADN4P0ZM/xGGm1Po= From: Tsukasa OI To: Tsukasa OI , Nelson Chu , Kito Cheng , Palmer Dabbelt Cc: binutils@sourceware.org Subject: [PATCH 04/12] RISC-V: GAS: Add basic shared test utilities Date: Sat, 5 Nov 2022 12:29:10 +0000 Message-Id: <6a020edd0e114a003edbaafe1088a040e9fa07e7.1667651354.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This commit adds basic shared test utilities intended for future extension tests. gas/ChangeLog: * testsuite/gas/riscv/testutils.inc: New test utilities. --- gas/testsuite/gas/riscv/testutils.inc | 113 ++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 gas/testsuite/gas/riscv/testutils.inc diff --git a/gas/testsuite/gas/riscv/testutils.inc b/gas/testsuite/gas/riscv/testutils.inc new file mode 100644 index 00000000000..009484eefed --- /dev/null +++ b/gas/testsuite/gas/riscv/testutils.inc @@ -0,0 +1,113 @@ +# Set NOARCH symbols. +.ifndef NOARCH +.set NOARCH, 0 +.endif +.ifndef NOARCH_ARCH +.set NOARCH_ARCH, 0 +.endif +.ifndef NOARCH_XLEN +.set NOARCH_XLEN, 0 +.endif +.if NOARCH +.set NOARCH_ARCH, 1 +.set NOARCH_XLEN, 1 +.endif + +# Update XLEN constraint symbols. +# For intentional error handling tests, .if SYM ... .endif block should be +# used to test those varibales. +.macro UPDATE_XLEN + .if NOARCH_XLEN + # When NOARCH_XLEN is set, + # set those variables to "invalid" 1 to generate errors. + .set XLEN_EQ_32, 1 + .set XLEN_EQ_64, 1 + .set XLEN_GE_64, 1 + .else + # Set symbol values depending on the XLEN. + .ifdef XLEN + .ifeq XLEN-32 + .set XLEN_EQ_32, 1 + .else + .set XLEN_EQ_32, 0 + .endif + .ifeq XLEN-64 + .set XLEN_EQ_64, 1 + .else + .set XLEN_EQ_64, 0 + .endif + .ifge XLEN-64 + .set XLEN_GE_64, 1 + .else + .set XLEN_GE_64, 0 + .endif + .else + .set XLEN_EQ_32, 0 + .set XLEN_EQ_64, 0 + .set XLEN_GE_64, 0 + .endif + .endif +.endm +UPDATE_XLEN + +# Set the base architecture. +.macro SET_BASE_FORCE xlen, basearch=i + .option arch, rv\xlen\basearch + .set XLEN, \xlen + UPDATE_XLEN +.endm + +# Set the base architecture unless the symbol NOARCH_ARCH is set. +.macro SET_BASE xlen, basearch=i + .if !NOARCH_ARCH + SET_BASE_FORCE \xlen, \basearch + .endif +.endm + +# Begin base architecture block. +.macro SET_BASE_START_FORCE xlen, basearch=i + .option push + SET_BASE_FORCE \xlen, \basearch +.endm + +# Begin base architecture block. +# Don't change the architecture if NOARCH_ARCH is set. +.macro SET_BASE_START xlen, basearch=i + .option push + SET_BASE \xlen, \basearch +.endm + +# End base architecture block. +.macro SET_BASE_END + .option pop +.endm + +# Set the architecture. +.macro SET_ARCH_FORCE arch + .option arch, \arch +.endm + +# Set the architecture unless the symbol NOARCH_ARCH is set. +.macro SET_ARCH arch + .ifeq NOARCH_ARCH-0 + SET_ARCH_FORCE \arch + .endif +.endm + +# Begin architecture block. +.macro SET_ARCH_START_FORCE arch + .option push + SET_ARCH_FORCE \arch +.endm + +# Begin architecture block. +# Don't change the architecture if NOARCH_ARCH is set. +.macro SET_ARCH_START arch + .option push + SET_ARCH \arch +.endm + +# End architecture block. +.macro SET_ARCH_END + .option pop +.endm -- 2.37.2