From patchwork Sat May 8 10:12:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YunQiang Su X-Patchwork-Id: 1475828 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=cipunited.onmicrosoft.com header.i=@cipunited.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-cipunited-onmicrosoft-com header.b=EukzfDGz; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FcjnV3LRlz9sX1 for ; Sat, 8 May 2021 20:13:16 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9C331385481A; Sat, 8 May 2021 10:13:13 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from APC01-PU1-obe.outbound.protection.outlook.com (mail-eopbgr1320099.outbound.protection.outlook.com [40.107.132.99]) by sourceware.org (Postfix) with ESMTPS id 85C923857814 for ; Sat, 8 May 2021 10:13:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 85C923857814 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cipunited.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yunqiang.su@cipunited.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RbxJBqgsc1eONioFUsac47ErsQFgWVH5e0IExaXXY9DPunSyPJtsszXQx4DiOes4RjhnnX8lC1UDhUkA+rxPrDGwJOhyzTHlsWQ2LsBPJXMsNrtTnNmUckiZfExO7uQlSR/W86yHmmr/WppJV4rlkETTQJcP4NF8HrrXCefptw9EZViONI6iUmTLxGtuJYQZO+MQ0Aiso9NOeNmGuz26LjXJuwCzdIC25GebdhSKkQkHxKpmxuKZeKDsA923oq8sOcHUeLSMByMcJlKAp6Sb93qgyijI0e2BhJEqlt+Zz50TfY0AkM9rjQQk8B81IDrSicTImcqMim3MW/hxZWAsgQ== 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-SenderADCheck; bh=kKWLCDD+cvIs+Uiu4tJ+ZVvqTZA4DSru6PjDFEsqkyA=; b=lDN7egnN9X5Fq4D6YeThFkONYeRhHbKG6uq7vDrQ0Nym+0lGk3issBbaHra44pkoD19UTFhFoXHk7UdR107NEsCe/sDNHFb7d7cVQJbyT0O8e4fIoJ0ERoPfaoeNzmzS5SV8WgBdzlwfOzNbwbrhmyocC9C2SxruUIZXjZnfI0iHVA96VgzZbo4iiQg+RFbs7sEECj/HLytJpM2ddTY47qrkqRMtiMwrQyByvRV5p+ONnbUOrzEy+rFP/XrTXAVWEKvpgU4bUlBKn1bVp5ZIgS1NuIwP5mgkPn86C4k9Af4QaHRA91Jd57nq3GdI2myThT9vBgBS5rYl/O32MLZMtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cipunited.com; dmarc=pass action=none header.from=cipunited.com; dkim=pass header.d=cipunited.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cipunited.onmicrosoft.com; s=selector1-cipunited-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kKWLCDD+cvIs+Uiu4tJ+ZVvqTZA4DSru6PjDFEsqkyA=; b=EukzfDGz85tb9GUZzV5IPcddk2e3ndgs89yN4ZH4C8MPsL3ZkrSznp8M4nnT2i4Ft5MKAYtzK73FHJ4o9Alo7+K/1FLU9IX6LTZgrBgPb8Wg2uPm1eSYuer/34ghimRwGeCJAWVWpB899gwiHqrSLMFpGNzeY6VwdVIzFFV20GU= Authentication-Results: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=cipunited.com; Received: from HKAPR04MB3956.apcprd04.prod.outlook.com (2603:1096:203:d5::13) by HK0PR04MB3203.apcprd04.prod.outlook.com (2603:1096:203:89::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Sat, 8 May 2021 10:12:59 +0000 Received: from HKAPR04MB3956.apcprd04.prod.outlook.com ([fe80::353c:dd6f:35c8:bcff]) by HKAPR04MB3956.apcprd04.prod.outlook.com ([fe80::353c:dd6f:35c8:bcff%6]) with mapi id 15.20.4108.030; Sat, 8 May 2021 10:12:59 +0000 From: YunQiang Su To: gcc-patches@gcc.gnu.org Subject: [PATCH v2] MIPS: R6: load/store can process unaligned address Date: Sat, 8 May 2021 06:12:13 -0400 Message-Id: <20210508101213.3829712-1-yunqiang.su@cipunited.com> X-Mailer: git-send-email 2.30.2 X-Originating-IP: [60.247.76.87] X-ClientProxiedBy: HK2PR0401CA0014.apcprd04.prod.outlook.com (2603:1096:202:2::24) To HKAPR04MB3956.apcprd04.prod.outlook.com (2603:1096:203:d5::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (60.247.76.87) by HK2PR0401CA0014.apcprd04.prod.outlook.com (2603:1096:202:2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Sat, 8 May 2021 10:12:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 391f9d0e-502f-487c-f05a-08d91209db71 X-MS-TrafficTypeDiagnostic: HK0PR04MB3203: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oWYLoA2lLtY2LS9bautp/KS8QOMnrIwMCRZ20lcyyco7i0TpK5/50LLhzPLWBA41KNBoRPbCxyHU0HPb/UUENvN9fHb0Ybow52lzMsN0PpicQpDVGTxHaY4BTniwaoOb8jOClH2fDjyEcrhUIulVY8DxoO7lP5qNTIDhCsaWQwfYG1sY2s5Rtk5Qxb25fIo3xREhhiMRO33Iw/8oCoAK4bRMZKfuAs3h89D3FWtS1ZohgQyiROxP43/hWSdkDNR2DOvTv2Y3G+xVV9WJO/1Xo/nZKmzwoOWl9MsurxpGRpCljJgDGu5e5CJ+a5GFA9OooSlYNDepwubOgGWQZY0JO907BWxTsnARjpOOGgrBPSLYLZ0bzB40joyO5QkbOuN5w8RP5jUnzUYESZ7mEUK/uRolkqQMJkKb8EAfoTGKRVOjLDxyJVek8impvHkueV6HtxQs1KnbeXTsYQMJ8l2IRhRlFLUDu6EDwABzPu3VeaJFQARHVpPIg+I7+9L2TO8dDNqsi9pPpNLrcFS8aduAOOXERaSoFQoLN+V7w1ovmsw668fdBs3+5vFRU4CE56XgetaI5CrwFOjgIul0rO0xU4nI5vCp+KFC7DMWsubeKLf2q4Hfh3RzighfBFXCLZ7qElm3dJ8V2NmYhoPdgfOb1Yy08zYjqxMcVoYlNqMaCLl5+mtnnlow4OGCOD0Iy5WI X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HKAPR04MB3956.apcprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(396003)(39830400003)(346002)(376002)(36756003)(478600001)(6506007)(86362001)(66556008)(52116002)(66476007)(83380400001)(6916009)(2906002)(107886003)(6512007)(38100700002)(38350700002)(66946007)(316002)(1076003)(6486002)(186003)(16526019)(26005)(5660300002)(4326008)(8936002)(956004)(6666004)(8676002)(2616005)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Lb4hfvNC+XltX+CEQOBgf7t7uNJVEeBVUjcnqlk2jAxzuXVr0kwMOan0IU8sakd3jD1mFd/XJx3iXmN5zblXsIHxhkHEYqq+o/G4XGk6QMiMf5FB6fgPa88YAhfms0Ru0yWOcNYYOfRMV8ewIHskZlXQRACavkrtq/VW3LklqahjzbxTUjFuu23e6bo1SJ2R58/xhj85yjsJ0+RKp7m/0TihFKfkX4pM4oUfwuCIyX9vG+dcwbuFlv0CstWsj71SZWauygM/X/u6zK7X7Re/lHN8hAnLq/OoPC1VS6G5JmCHSuoG4abZkrDqzELXLgUL61pm5GMuFe4UclqcJkWEHcWzPhqHiZQVY8NKIXhTWTuif4A7Ljux3so9U1W+QgKL04QwyKIKMcbszHko0FHQN6JMH7mU+1s3t1DAIj5du0Y7sRrfRZ8BTH5xxDncTTcrIoGbRux9rLaOJ0iYKVDFo3cCNLD0fKnFsy+XHZtCZUU3Mfhmxas1Y3RCziCM5y8+f3vJHZ+XQliIp14gUcdLYgGnLc7dYWemoma3b9YMfHMXnFdUQyR07TC0NTJT/DM/6OcqmyLqgykxpaOLR7msUcsy1i5ZwTewDzjaINi38FCLyesn90jyffsBRhFOUW3rSpbk4yt4GjzfTVbZXv+J6gc8ij16VRzNOR+clbiK2Cug6kqbXVarS72g2YEF4XSl71oUm03BlnRRvO9K/uophQ0lf25yPPVgpdINZjUgFIXgh2N8Cd3moGT+z7o4l98O4kIzPkAkhkjuZY5HOjQVwVdf04rgwGuqA0GUTxOnW7vLz2Dee2YNadt1VsrP1KRqeMtqAigoAa97u0lyOfY48T4w7aNv7l2+h8MGoYsZaOvsowQHS6oRxnLA+3iV3ehTa6GiKxeZtanEmN0/zoj2jlZgbPFwPaHL2cAvtYK7yhYRSB0A1r/3p0Wo9RJbirakxyhuGOX84JsNmg3raKKPjvGbb6UGKzxtb+z/vsHU2uFYtiEEjS1titpITneVkMykv4mWD50SqpLWvgLfbOElPxWDDFn/uB49TYi5vdwsTVPg6XqaSBg6/gCgvTZb13s8fr3HC86xcLaslWuNQdrQ/n+h5RSb9WSdSY3CS9m5eB9znKlbepdlde3MkZwzY7vBqhMJTWTSdffy+KizIBJw3VEQLDirJNyXe/32RJnoWdbdyh/MugDIJenknJv5YIapMjEE3jiyjexsJ0+MShAOhQYQhmmWKH7/66wHJh9r7VayOrYy+cGF+3DGTxJSRuySqE10+81QD9TlNNkSYe/HF9Aoa9o9BDiQupTeTIgRmaumCHNXGmQV6n3LDskBqD66 X-OriginatorOrg: cipunited.com X-MS-Exchange-CrossTenant-Network-Message-Id: 391f9d0e-502f-487c-f05a-08d91209db71 X-MS-Exchange-CrossTenant-AuthSource: HKAPR04MB3956.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2021 10:12:59.6772 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e31cf5b5-ee69-4d5f-9c69-edeeda2458c0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1XtxKV6R89AFb2HMlK4AsrTEnIP44OIa3D7KY1WuxrpCqq5QmI8Uhajhy5tfoiGhbxDeMpMb8K9tX5iFuKgjSdJcbp07aTvM9HAs/6TwO7Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK0PR04MB3203 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_STOCKGEN, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: YunQiang Su , jiaxun.yang@flygoat.com, macro@orcam.me.uk Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" MIPS release 6 requires the lw/ld/sw/sd can work with unaligned address, while it can be implemented by full hardware or trap&emulate. Since it is may be fully done by hardware, we add an option -m(no-)unaligned-access, the kernel may need it. gcc/ChangeLog: * config/mips/mips.h (ISA_HAS_UNALIGNED_ACCESS): (STRICT_ALIGNMENT): R6 can unaligned access. * config/mips/mips.md (movmisalign): Likewise. * config/mips/mips.opt: add -m(no-)unaligned-access * doc/invoke.texi: Likewise. gcc/testsuite/ChangeLog: * gcc.target/mips/mips.exp: add unaligned-access * gcc.target/mips/unaligned-2.c: New test. * gcc.target/mips/unaligned-3.c: New test. --- gcc/config/mips/mips.h | 6 ++- gcc/config/mips/mips.md | 10 ++++ gcc/config/mips/mips.opt | 4 ++ gcc/doc/invoke.texi | 10 ++++ gcc/testsuite/gcc.target/mips/mips.exp | 1 + gcc/testsuite/gcc.target/mips/unaligned-2.c | 53 +++++++++++++++++++++ gcc/testsuite/gcc.target/mips/unaligned-3.c | 53 +++++++++++++++++++++ 7 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/mips/unaligned-2.c create mode 100644 gcc/testsuite/gcc.target/mips/unaligned-3.c diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 47aac9d3d61..22a0d449aab 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -226,6 +226,10 @@ struct mips_cpu_info { && (mips_isa_rev >= 6 \ || ISA_HAS_MSA)) +/* ISA load/store instructions can handle unaligned address */ +#define ISA_HAS_UNALIGNED_ACCESS (TARGET_UNALIGNED_ACCESS \ + && (mips_isa_rev >= 6)) + /* The ISA compression flags that are currently in effect. */ #define TARGET_COMPRESSION (target_flags & (MASK_MIPS16 | MASK_MICROMIPS)) @@ -1666,7 +1670,7 @@ FP_ASM_SPEC "\ (ISA_HAS_MSA ? BITS_PER_MSA_REG : LONG_DOUBLE_TYPE_SIZE) /* All accesses must be aligned. */ -#define STRICT_ALIGNMENT 1 +#define STRICT_ALIGNMENT (!ISA_HAS_UNALIGNED_ACCESS) /* Define this if you wish to imitate the way many other C compilers handle alignment of bitfields and the structures that contain diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index eef3cfd50a8..40e29c60432 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -4459,6 +4459,16 @@ (define_insn "mov_r" [(set_attr "move_type" "store") (set_attr "mode" "")]) +;; Unaligned direct access +(define_expand "movmisalign" + [(set (match_operand:JOIN_MODE 0) + (match_operand:JOIN_MODE 1))] + "ISA_HAS_UNALIGNED_ACCESS" +{ + if (mips_legitimize_move (mode, operands[0], operands[1])) + DONE; +}) + ;; An instruction to calculate the high part of a 64-bit SYMBOL_ABSOLUTE. ;; The required value is: ;; diff --git a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt index 6af8037e9bd..ebb4c616401 100644 --- a/gcc/config/mips/mips.opt +++ b/gcc/config/mips/mips.opt @@ -404,6 +404,10 @@ mtune= Target RejectNegative Joined Var(mips_tune_option) ToLower Enum(mips_arch_opt_value) -mtune=PROCESSOR Optimize the output for PROCESSOR. +munaligned-access +Target Var(TARGET_UNALIGNED_ACCESS) Init(1) +Generate code with unaligned load store, valid for MIPS R6. + muninit-const-in-rodata Target Var(TARGET_UNINIT_CONST_IN_RODATA) Put uninitialized constants in ROM (needs -membedded-data). diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 40cacc6f8e7..211a709fff8 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1062,6 +1062,7 @@ Objective-C and Objective-C++ Dialects}. -mcheck-zero-division -mno-check-zero-division @gol -mdivide-traps -mdivide-breaks @gol -mload-store-pairs -mno-load-store-pairs @gol +-munaligned-access -mno-unaligned-access @gol -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol -mfix-24k -mno-fix-24k @gol @@ -24999,6 +25000,15 @@ instructions to enable load/store bonding. This option is enabled by default but only takes effect when the selected architecture is known to support bonding. +@item -munaligned-access +@itemx -mno-unaligned-access +@opindex munaligned-access +@opindex mno-unaligned-access +Enable (disable) direct unaligned access for MIPS Release 6. +MIPSr6 requires load/store unaligned-access support, +by hardware or trap&emulate. +So @option{-mno-unaligned-access} may be needed by kernel. + @item -mmemcpy @itemx -mno-memcpy @opindex mmemcpy diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp index 01292316944..cb1ee7d71b5 100644 --- a/gcc/testsuite/gcc.target/mips/mips.exp +++ b/gcc/testsuite/gcc.target/mips/mips.exp @@ -264,6 +264,7 @@ set mips_option_groups { frame-header "-mframe-header-opt|-mno-frame-header-opt" stack-protector "-fstack-protector" stdlib "REQUIRES_STDLIB" + unaligned-access "-m(no-|)unaligned-access" } for { set option 0 } { $option < 32 } { incr option } { diff --git a/gcc/testsuite/gcc.target/mips/unaligned-2.c b/gcc/testsuite/gcc.target/mips/unaligned-2.c new file mode 100644 index 00000000000..8679afac400 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/unaligned-2.c @@ -0,0 +1,53 @@ +/* { dg-options "isa_rev>=6 -mgp64" } */ +/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */ +/* { dg-final { scan-assembler-not "\tsb\t" } } */ +/* { dg-final { scan-assembler-not "\tsh\t" } } */ +/* { dg-final { scan-assembler-not "\tlb\t" } } */ +/* { dg-final { scan-assembler-not "\tlh\t" } } */ +/* { dg-final { scan-assembler-not "\tswl\t" } } */ +/* { dg-final { scan-assembler-not "\tswr\t" } } */ +/* { dg-final { scan-assembler-not "\tlwl\t" } } */ +/* { dg-final { scan-assembler-not "\tlwr\t" } } */ +/* { dg-final { scan-assembler-not "\tsdl\t" } } */ +/* { dg-final { scan-assembler-not "\tsdr\t" } } */ +/* { dg-final { scan-assembler-not "\tldl\t" } } */ +/* { dg-final { scan-assembler-not "\tldr\t" } } */ +/* { dg-final { scan-assembler-times "\tsw\t" 1 } } */ +/* { dg-final { scan-assembler-times "\tlw\t" 1 } } */ +/* { dg-final { scan-assembler-times "\tsd\t" 1 } } */ +/* { dg-final { scan-assembler-times "\tld\t" 1 } } */ +/* { dg-final { scan-assembler-not "\tnop" } } */ + +/* Test to make sure we produce the unaligned load/store for + both 64bit and 32bits sized accesses. */ + +struct s +{ + char c; + int i; + long long l; +} __attribute__ ((packed)) s __attribute__((aligned(1) )); + +NOMIPS16 void +sd (long long l) +{ + s.l = l; +} + +NOMIPS16 long long +ld () +{ + return s.l; +} + +NOMIPS16 void +sw (int i) +{ + s.i = i; +} + +NOMIPS16 int +lw () +{ + return s.i; +} diff --git a/gcc/testsuite/gcc.target/mips/unaligned-3.c b/gcc/testsuite/gcc.target/mips/unaligned-3.c new file mode 100644 index 00000000000..d0fbe19de50 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/unaligned-3.c @@ -0,0 +1,53 @@ +/* { dg-options "isa_rev>=6 -mgp64 -mno-unaligned-access" } */ +/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */ +/* { dg-final { scan-assembler-times "\tsb\t" 12 } } */ +/* { dg-final { scan-assembler-times "\tlbu\t" 12 } } */ +/* { dg-final { scan-assembler-not "\tsh\t" } } */ +/* { dg-final { scan-assembler-not "\tlh\t" } } */ +/* { dg-final { scan-assembler-not "\tsw\t" } } */ +/* { dg-final { scan-assembler-not "\tlw\t" } } */ +/* { dg-final { scan-assembler-not "\tsd\t" } } */ +/* { dg-final { scan-assembler-not "\tld\t" } } */ +/* { dg-final { scan-assembler-not "\tswl\t" } } */ +/* { dg-final { scan-assembler-not "\tswr\t" } } */ +/* { dg-final { scan-assembler-not "\tlwl\t" } } */ +/* { dg-final { scan-assembler-not "\tlwr\t" } } */ +/* { dg-final { scan-assembler-not "\tsdl\t" } } */ +/* { dg-final { scan-assembler-not "\tsdr\t" } } */ +/* { dg-final { scan-assembler-not "\tldl\t" } } */ +/* { dg-final { scan-assembler-not "\tldr\t" } } */ +/* { dg-final { scan-assembler-not "\tnop" } } */ + +/* Test to make sure we produce the unaligned load/store for + both 64bit and 32bits sized accesses. */ + +struct s +{ + char c; + int i; + long long l; +} __attribute__ ((packed)) s __attribute__((aligned(1) )); + +NOMIPS16 void +sd (long long l) +{ + s.l = l; +} + +NOMIPS16 long long +ld () +{ + return s.l; +} + +NOMIPS16 void +sw (int i) +{ + s.i = i; +} + +NOMIPS16 int +lw () +{ + return s.i; +}