From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14861 invoked by alias); 16 Jan 2015 13:40:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 14848 invoked by uid 89); 16 Jan 2015 13:40:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Jan 2015 13:40:12 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by service87.mimecast.com; Fri, 16 Jan 2015 13:40:10 +0000 Received: from [10.1.203.161] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 16 Jan 2015 13:40:08 +0000 Message-ID: <54B914E0.9040909@arm.com> Date: Fri, 16 Jan 2015 13:43:00 -0000 From: Tejas Belagod User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Christophe Lyon , "gcc-patches@gcc.gnu.org" Subject: Re: [[ARM/AArch64][testsuite] 01/36] Add explicit dependency on Neon Cumulative Saturation flag (QC). References: <1421162314-25779-1-git-send-email-christophe.lyon@linaro.org> <1421162314-25779-2-git-send-email-christophe.lyon@linaro.org> In-Reply-To: <1421162314-25779-2-git-send-email-christophe.lyon@linaro.org> X-MC-Unique: 115011613401000401 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg01368.txt.bz2 On 13/01/15 15:17, Christophe Lyon wrote: > __set_neon_cumulative_sat() modifies the contents on the QC flag, and > some intrinsics do so too: this patch adds the explicit dependency on > the asm statement, to avoid code reordering or removal. > > When writing QC, the asm statement now has a fake input dependency, > which is the output of the intrinsic being tested. Modifying the > __set_neon_cumulative_sat macro is necessary, to be able to accept all > the possible input types. > > Update the generic code in unary_sat_op.inc and binary_sat_op.inc > accordingly. > > * gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h > (Set_Neon_Cumulative_Sat): Add parameter. > (__set_neon_cumulative_sat): Support new parameter. > * gcc.target/aarch64/advsimd-intrinsics/binary_sat_op.inc > (TEST_BINARY_SAT_OP1): Call Set_Neon_Cumulative_Sat with new > argument. > * gcc.target/aarch64/advsimd-intrinsics/unary_sat_op.inc > (TEST_UNARY_SAT_OP1): Call Set_Neon_Cumulative_Sat with new > argument. > > diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon= -ref.h b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h > index 8ea1f26..6464c66 100644 > --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h > +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h > @@ -255,7 +255,11 @@ typedef union { > #endif /* __ORDER_BIG_ENDIAN__ */ > > #define Neon_Cumulative_Sat __read_neon_cumulative_sat() > -#define Set_Neon_Cumulative_Sat(x) __set_neon_cumulative_sat((x)) > +/* We need a fake dependency to ensure correct ordering of asm > + statements to preset the QC flag value, and Neon operators writing > + to QC. */ > +#define Set_Neon_Cumulative_Sat(x, depend) \ > + __set_neon_cumulative_sat((x), (depend)) > > #if defined(__aarch64__) > static volatile int __read_neon_cumulative_sat (void) { > @@ -263,13 +267,12 @@ static volatile int __read_neon_cumulative_sat (voi= d) { > asm volatile ("mrs %0,fpsr" : "=3Dr" (_afpscr_for_qc)); > return _afpscr_for_qc.b.QC; > } > -static void __set_neon_cumulative_sat (int x) { > - _ARM_FPSCR _afpscr_for_qc; > - asm volatile ("mrs %0,fpsr" : "=3Dr" (_afpscr_for_qc)); > - _afpscr_for_qc.b.QC =3D x; > - asm volatile ("msr fpsr,%0" : : "r" (_afpscr_for_qc)); > - return; > -} > +#define __set_neon_cumulative_sat(x, depend) { \ > + _ARM_FPSCR _afpscr_for_qc; \ > + asm volatile ("mrs %0,fpsr" : "=3Dr" (_afpscr_for_qc)); \ > + _afpscr_for_qc.b.QC =3D x; \ > + asm volatile ("msr fpsr,%1" : "=3DX" (depend) : "r" (_afpscr_for_qc)= ); \ > + } > #else > static volatile int __read_neon_cumulative_sat (void) { > _ARM_FPSCR _afpscr_for_qc; > @@ -277,13 +280,12 @@ static volatile int __read_neon_cumulative_sat (voi= d) { > return _afpscr_for_qc.b.QC; > } > > -static void __set_neon_cumulative_sat (int x) { > - _ARM_FPSCR _afpscr_for_qc; > - asm volatile ("vmrs %0,fpscr" : "=3Dr" (_afpscr_for_qc)); > - _afpscr_for_qc.b.QC =3D x; > - asm volatile ("vmsr fpscr,%0" : : "r" (_afpscr_for_qc)); > - return; > -} > +#define __set_neon_cumulative_sat(x, depend) { \ > + _ARM_FPSCR _afpscr_for_qc; \ > + asm volatile ("vmrs %0,fpscr" : "=3Dr" (_afpscr_for_qc)); \ > + _afpscr_for_qc.b.QC =3D x; \ > + asm volatile ("vmsr fpscr,%1" : "=3DX" (depend) : "r" (_afpscr_for_q= c)); \ > + } > #endif > > /* Declare expected cumulative saturation results, one for each > diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/binary_s= at_op.inc b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/binary_sat_= op.inc > index 35d7701..c09a468 100644 > --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/binary_sat_op.i= nc > +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/binary_sat_op.i= nc > @@ -18,7 +18,7 @@ void FNNAME (INSN_NAME) (void) > /* vector_res =3D OP(vector1,vector2), then store the result. */ > > #define TEST_BINARY_SAT_OP1(INSN, Q, T1, T2, W, N, EXPECTED_CUMULATIVE_= SAT, CMT) \ > - Set_Neon_Cumulative_Sat(0); \ > + Set_Neon_Cumulative_Sat(0, VECT_VAR(vector_res, T1, W, N)); \ > VECT_VAR(vector_res, T1, W, N) =3D \ > INSN##Q##_##T2##W(VECT_VAR(vector1, T1, W, N), \ > VECT_VAR(vector2, T1, W, N)); \ > diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/unary_sa= t_op.inc b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/unary_sat_op= .inc > index 3f6d984..0da1426 100644 > --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/unary_sat_op.inc > +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/unary_sat_op.inc > @@ -17,7 +17,7 @@ void FNNAME (INSN_NAME) (void) > { > /* y=3DOP(x), then store the result. */ > #define TEST_UNARY_SAT_OP1(INSN, Q, T1, T2, W, N, EXPECTED_CUMULATIVE_S= AT, CMT) \ > - Set_Neon_Cumulative_Sat(0); \ > + Set_Neon_Cumulative_Sat(0, VECT_VAR(vector_res, T1, W, N)); \ > VECT_VAR(vector_res, T1, W, N) =3D \ > INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N)); \ > vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), \ > Looks OK to me(but I can't approve it). Tejas.