From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2045.outbound.protection.outlook.com [40.107.20.45]) by sourceware.org (Postfix) with ESMTPS id 1324C3858D20 for ; Fri, 11 Aug 2023 15:42:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1324C3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8affWLJUDPPgYoXygIIylzIvdAor8W94nPWKK/lOdGk=; b=Ug00rxkRx4YQidDbCeS1DhWm7ou7A1L4N+XSnvbMESirFdF07V85qb2BiFURgYMiB9IjWeT5TAOmqy7wpQMudjQtdNGU36c8d8TYo5q4nnRdtFauAT8a72aZecz9N9YGUDtMQk0cQVC9zrwaff1RlppPLFhaRW7kTY1HECU64no= Received: from AS4P189CA0053.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:659::17) by PAVPR08MB9883.eurprd08.prod.outlook.com (2603:10a6:102:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Fri, 11 Aug 2023 15:42:38 +0000 Received: from AM7EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:659:cafe::5b) by AS4P189CA0053.outlook.office365.com (2603:10a6:20b:659::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.31 via Frontend Transport; Fri, 11 Aug 2023 15:42:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT005.mail.protection.outlook.com (100.127.140.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.19 via Frontend Transport; Fri, 11 Aug 2023 15:42:38 +0000 Received: ("Tessian outbound 5c548696a0e7:v175"); Fri, 11 Aug 2023 15:42:38 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: facab864d10d01ad X-CR-MTA-TID: 64aa7808 Received: from 4da024d90de0.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F67A8FB3-BB19-46BD-AD73-B22060E15F28.1; Fri, 11 Aug 2023 15:42:32 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 4da024d90de0.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 11 Aug 2023 15:42:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T0C/DIY3cOV2qnWsEOrtFI1KQm4sT1/HPnuNceGuH0pUcF6ZyzMExMTbvwKV1vmxFwKxK7YzSFxOjKJOCluhi6jtlgXH7X1Og8rgsfVuIVgRxUDvoQtZB/DrIpLAcKOP/8fLHLqoqp5RmLxh8U9pGLv3oBF0lG3ORj9k3IzpEuIaJ9W6cGWEZS/BG1PzdNxwemQgBKn/WLtdabDLw89x6tC02oaYdGZZze0czhw3X65L+UlPiN5mbnjpF3X+hU9EB+8wmLmuR5DG/qos3UuqlQhJQSYsYpFf6WoEDboUUyMGcjTJv8zacCsEoYNp/BVdy+Q7U6Zp5fHg0DWwZhY2uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8affWLJUDPPgYoXygIIylzIvdAor8W94nPWKK/lOdGk=; b=Hi4RGjY40tdMxpZhhtaZm0F12u0WoV4eknDX1lMADOAezFgWOcpSFMd1Zt1n825yHXIo5t40e5opI0bNq8k1+e831m1l1PTcr2TLsI2qEW0fUWlygsCKTk+b0o8NIn0XhJXMgYokbXT0pZ8QzVRj5pTkRaIli/wDHfa0Gx3RhS3iq9jEJhLERVEzheF0BP6Utu0Nc7JB3/JAoEf1virAIme+zPUX0MevyqR+Q04WK91DncP0VHTDYw+30Qs0jGYlNITxpTmySke7b+8ASHWW+Epj6nkQJd28C43jvIdpbUV6glCti6pFAJd5ol5HzyGDMbZK+tZB43KJGMuE6wpixA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8affWLJUDPPgYoXygIIylzIvdAor8W94nPWKK/lOdGk=; b=Ug00rxkRx4YQidDbCeS1DhWm7ou7A1L4N+XSnvbMESirFdF07V85qb2BiFURgYMiB9IjWeT5TAOmqy7wpQMudjQtdNGU36c8d8TYo5q4nnRdtFauAT8a72aZecz9N9YGUDtMQk0cQVC9zrwaff1RlppPLFhaRW7kTY1HECU64no= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by PAXPR08MB6349.eurprd08.prod.outlook.com (2603:10a6:102:15b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Fri, 11 Aug 2023 15:42:30 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::7743:60fe:4859:2df2]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::7743:60fe:4859:2df2%5]) with mapi id 15.20.6652.029; Fri, 11 Aug 2023 15:42:30 +0000 Message-ID: <26331934-4e54-5ed6-1c35-ed1c66262ba2@arm.com> Date: Fri, 11 Aug 2023 16:42:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v3 15/16] [gdb/testsuite] sme: Add SVE/SME testcases To: Thiago Jung Bauermann Cc: gdb-patches@sourceware.org References: <20230630134616.1238105-1-luis.machado@arm.com> <20230630134616.1238105-16-luis.machado@arm.com> <87r0ojzkp4.fsf@linaro.org> Content-Language: en-US From: Luis Machado In-Reply-To: <87r0ojzkp4.fsf@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO0P123CA0003.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:354::11) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|PAXPR08MB6349:EE_|AM7EUR03FT005:EE_|PAVPR08MB9883:EE_ X-MS-Office365-Filtering-Correlation-Id: f60baca1-4f9f-437f-ab46-08db9a819787 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: TnlvvE4SA0050F+wpZMF3lKwtAAK/eHbSxGjRXooqMmJS8iTngYspe3CowZDR9hlWmhcZdKjJR1T4gqYV5mJUNb4scrX80vj0JekVoe4iNL7JxA2svIgDtXINCwdTF2hiKRWSZCIWS8/umwbhwwVQs7xvNfR60HiSPobNgsW3eKgan2oK6/uc3DL79hK6adTyid20oSutlZokPf6UifC7U0TSbLCLE8h1UGl8R+nMNZv6M3Y3PdmZpdMM5Ki/iAKTwEv9vMKwnRYGGUQ8JgMh1PvTvPf4FdDroUA7PjjVz3kktw3oEhDNQC4vQPeGvMssTXWUTNdJTsDEFcmx+GjBqm2K82D38I2T+iQDvQxFuJpGreexikxTKg8vIwnKkOLdmeonkic1/23kbkMxcp4DOb4yXzTvMc2O8xpVJ/NA9hHDazLldX9uUwS2dqOPEBTU1mzpP/43dK3tDQa1pg4dLuq5cxg0ShGnXs+NzP82St72UKPiTr790BgAMmZb0qLwWudHZbA6pyn1WdKSN7sUrpTFtoXaktGN7QCFmztViDRRqc4hTl7GnFHHwzCvdH+NHJWjE1arbhSgnZ0m3ZRYxTza3pyW+ebCVBdP+DQgZYRnAW3LVquIvMQacZtrWn492TciU3FvZLAkVGRIJFBiXYcAlRP4/pJi05VeyiDQxc= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR08MB3919.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(366004)(376002)(346002)(136003)(396003)(186006)(451199021)(1800799006)(2616005)(44832011)(31696002)(86362001)(6486002)(2906002)(6666004)(36756003)(6512007)(6506007)(53546011)(478600001)(26005)(38100700002)(41300700001)(316002)(4326008)(66476007)(66556008)(6916009)(66946007)(31686004)(8676002)(8936002)(5660300002)(2004002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6349 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: c7d51d14-0c6c-47b8-1240-08db9a81926b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YLubbpdYFELsrm2151JLjWDx2uJAK/0+MhtPy3zMRK5Nv75v5BiMXodTc3WSh+1+/Gw2mZB+Vxj2g4T4ButH0UTKH8ky8uLVBj7VRy5iQq0fu1L9TyUuvRWTUjDWlkwhn981JOmUBjfQ6WtKYrfnf0ThS3SAkjNKofqfGRc/bZTcSl27jdu1UzSU++NsUIgRni9FM83BbnjKoGq5GmQJs5z66L62JWPYbpoo7M3TTJgoRoZ4xsR77Xi6Uf3bDLX+5GfFMNRQmjOJ4E0ZLsUQwxF31hdCHpIwel5OsXi7CAaUFSmorZNO065x67Rf/NnuTgaGqS63P2sHcWbH0MDEmrED722TpWTCQk6DgN1e1GupTNZSoxGOhEaAmAJHg2XzzC8hOjUg2YiNqmgmQPEFIaoV/cZ+HqwMUBZZZKo+UvK7GuaLA830hAb5+rvTDC8zmuaXYJn5EeqWf5vKDSR9ObAteaDxpz9+DFX2ibk2NcjSGKZbuDoP4op3EHxqVJ+g9lxhupFHPoT1izwtVZvIHPm0Qqc+E12FwIoVhocBKAKADdtOEw81xMLOTgO25nId/eAa/uqgaUCHY6Cft2L7atrPNwxpzXmv1oUun/LqB3bbEOXoZ6iTPdsOACPdFnbQhx5udwewmAwATCzfzhmeoNndgmmaU7FMyPmn1ErYma16twcMY8vTTACTPk1TgxylCppHca9pD+OtCWIZZpRkNMw9L8x5z+9P0kHPhuo2tg6LkKKtxKe6w5bM4/Rb5SJnayO631pHPux3lZG4EhTEnTUpa4CtbkoczJGxqp3r3JQ= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(136003)(376002)(396003)(346002)(1800799006)(186006)(451199021)(82310400008)(40470700004)(36840700001)(46966006)(31686004)(31696002)(40460700003)(40480700001)(53546011)(26005)(70206006)(6506007)(336012)(6666004)(70586007)(478600001)(36756003)(47076005)(36860700001)(2616005)(41300700001)(316002)(44832011)(6512007)(6486002)(4326008)(2906002)(86362001)(8936002)(81166007)(82740400003)(356005)(6862004)(8676002)(5660300002)(2004002)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2023 15:42:38.5985 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f60baca1-4f9f-437f-ab46-08db9a819787 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR08MB9883 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_NONE,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY 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: Hi, On 8/4/23 01:59, Thiago Jung Bauermann wrote: > > Luis Machado via Gdb-patches writes: > >> diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-core-0.exp b/gdb/testsuite/gdb.arch/aarch64-sme-core-0.exp >> new file mode 100644 >> index 00000000000..c4755346bc8 >> --- /dev/null >> +++ b/gdb/testsuite/gdb.arch/aarch64-sme-core-0.exp >> @@ -0,0 +1,18 @@ >> +# Copyright 2023 Free Software Foundation, Inc. >> + >> +# This program is free software; you can redistribute it and/or modify >> +# it under the terms of the GNU General Public License as published by >> +# the Free Software Foundation; either version 3 of the License, or >> +# (at your option) any later version. >> +# >> +# This program is distributed in the hope that it will be useful, >> +# but WITHOUT ANY WARRANTY; without even the implied warranty of >> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> +# GNU General Public License for more details. >> +# >> +# You should have received a copy of the GNU General Public License >> +# along with this program. If not, see . */ >> + >> +set id_start 0 >> +set id_end 24 > > It would be useful to have a comment mentioning that the range above > tests the fpsimd state. > > Same comment for the other aarch64-sme-*.exp tests. > Yeah. That can be a bit obscure. I'll add some more documentation to that effect. The current arrangement is mostly aiming at splitting these tests in a way that minimizes the total run time. I'm considering further splitting these, putting each test with SVL == 256 into its own file. Those are the ones that take the longest to run. The others can be grouped. Right now the split is based on continuous ranges (0~4, 5~9 etc). I may change that to a list instead. That will allow us to clearly specify the tests we want for each sub-file, hopefully causing each sub-test to have more or less the same run time. >> +source $srcdir/$subdir/aarch64-sme-core.exp.tcl > > > >> +require is_aarch64_target >> + >> +if {![allow_aarch64_sve_tests]} { >> + verbose "Skipping ${gdb_test_file_name}." >> + return >> +} >> + >> +if {![allow_aarch64_sme_tests]} { >> + verbose "Skipping ${gdb_test_file_name}." >> + return >> +} > > Can these "allow" tests also be invoked using "require"? > This question applies for all aarch64-sme-*.exp.tcl files. > Yes. When I started this code, we had not switched to this new format. Fixed now. >> + >> +test_sme_core_file $id_start $id_end > > > >> +# >> +# Return the state string based on STATE >> +# >> +proc state_id_to_state_string { state } { >> + if {$state == 0} { >> + return "fpsimd" >> + } elseif {$state == 1} { >> + return "sve" >> + } elseif {$state == 2} { >> + return "ssve" >> + } elseif {$state == 3} { >> + return "za" >> + } elseif {$state == 4} { >> + return "za_ssve" >> + } >> +} >> + >> +# >> +# Given a test ID, return the string representing the register state. >> +# The state is one of fpsimd, sve, ssve, za and za_ssve. >> +# >> +proc test_id_to_state { id } { >> + set state [expr $id / 25] >> + >> + return [state_id_to_state_string $state] >> +} >> + >> +# >> +# Given a test ID, return the associated vector length. >> +# >> +proc test_id_to_vl { id } { >> + return [expr 16 << (($id / 5) % 5)] >> +} >> + >> +# >> +# Given a test ID, return the associated streaming vector length. >> +# >> +proc test_id_to_svl { id } { >> + return [expr 16 << ($id % 5)] >> +} > > I suggest adding an sme_ prefix to the procedures above, since "id" here > is specific to SME testcases. > See below. >> +# >> +# With register STATE, vector length VL and streaming vector length SVL, >> +# run some register state checks to make sure the values are the expected >> +# ones >> +# >> +proc check_state { state vl svl } { >> + # The FPSIMD registers are initialized with a value of 0x55 (85) >> + # for each byte. >> + # >> + # The SVE registers are initialized with a value of 0xff (255) for each >> + # byte, including the predicate registers and FFR. >> + # >> + # The SME (ZA) register is initialized with a value of 0xaa (170) for >> + # each byte. >> + >> + # Check VG to make sure it is correct >> + set expected_vg [expr $vl / 8] >> + # If streaming mode is enabled, then vg is actually svg. >> + if {$state == "ssve" || $state == "za_ssve"} { >> + set expected_vg [expr $svl / 8] >> + } >> + gdb_test "print \$vg" " = ${expected_vg}" >> + >> + # Check SVG to make sure it is correct >> + set expected_svg [expr $svl / 8] >> + gdb_test "print \$svg" " = ${expected_svg}" >> + >> + # Check the value of SVCR. >> + gdb_test "print \$svcr" [get_svcr_value $state] >> + >> + # When we have any SVE or SSVE state, the FPSIMD registers will have >> + # the same values as the SVE/SSVE Z registers. >> + set fpsimd_byte 85 >> + if {$state == "sve" || $state == "ssve" || $state == "za_ssve"} { >> + set fpsimd_byte 255 >> + } >> + >> + set sve_byte 255 >> + if {$state == "fpsimd" || $state == "za"} { >> + set sve_byte 85 >> + } >> + >> + # Check FPSIMD registers >> + check_fpsimd_regs $fpsimd_byte $state $vl $svl >> + # Check SVE registers >> + check_sve_regs $sve_byte $state $vl $svl >> + # Check SME registers >> + check_sme_regs 170 $state $svl >> +} > > Also here, perhaps call this function "check_sme_state"? > Maybe. Instead of renaming these functions, how about renaming the helper .exp file from aarch64.exp to aarch64-sme.exp? Or maybe split it into a sme-specific part and a generic part. Moving forward, I'd like to make these tests cover SVE as well. In that case, we would be able to reuse some of these functions to raise the coverage of tests. What do you think? >> +# Run a test on the target to see if it supports Aarch64 SME extensions. >> +# Return 0 if so, 1 if it does not. Note this causes a restart of GDB. >> + >> +gdb_caching_proc allow_aarch64_sme_tests {} { >> + global srcdir subdir gdb_prompt inferior_exited_re >> + >> + set me "allow_aarch64_sme_tests" >> + >> + if { ![is_aarch64_target]} { >> + return 0 >> + } >> + >> + set compile_flags "{additional_flags=-march=armv8-a+sme}" >> + >> + # Compile a test program containing SVE instructions. > > s/SVE/SME/ > Oops. Fixed now. >> + set src { >> + int main() { >> + asm volatile ("smstart za"); >> + return 0; >> + } >> + } >> + if {![gdb_simple_compile $me $src executable $compile_flags]} { > >