From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A26403857C43; Fri, 5 Nov 2021 13:42:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A26403857C43 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/103098] bogus error: the last argument must be an 8-bit immediate Date: Fri, 05 Nov 2021 13:42:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution cc bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2021 13:42:42 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103098 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID CC| |jakub at gcc dot gnu.org Status|NEW |RESOLVED --- Comment #5 from Jakub Jelinek --- Re: #c2, the fact that they are listed in documentation doesn't really mean they are supported, the documentation also doesn't mention what they do and what constraints they have. The only supported way is to use the <*intrin.h> intrinsics. The fact that the above is diagnosed as invalid is right, the builtin requi= res that the immediate satisfies const_0_to_255_mul_8_operand predicate. Yes, the diagnostics isn't fully accurate that it doesn't tell you that the last argument must be an 8-bit immediate which is a multiple of 8, but hand= ling it for all the possible cases exactly would be complicated, we e.g. have (define_predicate "const0_operand" (define_predicate "const1_operand" (define_predicate "constm1_operand" (define_predicate "const8_operand" (define_predicate "const128_operand" (define_predicate "const248_operand" (define_predicate "const123_operand" (define_predicate "const2367_operand" (define_predicate "const1248_operand" (define_predicate "const359_operand" (define_predicate "const_4_or_8_to_11_operand" (define_predicate "const48_operand" (define_predicate "const_0_to_1_operand" (define_predicate "const_0_to_3_operand" (define_predicate "const_0_to_4_operand" (define_predicate "const_0_to_5_operand" (define_predicate "const_0_to_7_operand" (define_predicate "const_0_to_15_operand" (define_predicate "const_0_to_31_operand" (define_predicate "const_0_to_63_operand" (define_predicate "const_0_to_255_operand" (define_predicate "const_0_to_255_mul_8_operand" (define_predicate "const_1_to_31_operand" (define_predicate "const_1_to_63_operand" (define_predicate "const_2_to_3_operand" (define_predicate "const_4_to_5_operand" (define_predicate "const_4_to_7_operand" (define_predicate "const_6_to_7_operand" (define_predicate "const_8_to_9_operand" (define_predicate "const_8_to_11_operand" (define_predicate "const_8_to_15_operand" (define_predicate "const_10_to_11_operand" (define_predicate "const_12_to_13_operand" (define_predicate "const_12_to_15_operand" (define_predicate "const_14_to_15_operand" (define_predicate "const_16_to_19_operand" (define_predicate "const_16_to_31_operand" (define_predicate "const_20_to_23_operand" (define_predicate "const_24_to_27_operand" (define_predicate "const_28_to_31_operand" used by various instructions, but we'd just waste energy on something that isn't really needed; grep __builtin_ia32_pslldqi128 *intrin.h emmintrin.h: return (__m128i)__builtin_ia32_pslldqi128 (__A, __N * 8); emmintrin.h: return (__m128i)__builtin_ia32_pslldqi128 (__A, __N * 8); emmintrin.h: ((__m128i)__builtin_ia32_pslldqi128 ((__m128i)(A), (int)(N) *= 8)) emmintrin.h: ((__m128i)__builtin_ia32_pslldqi128 ((__m128i)(A), (int)(N) *= 8)) xmmintrin.h: __A128 =3D __builtin_ia32_pslldqi128 (__A128, 8); xmmintrin.h: __N128 =3D __builtin_ia32_pslldqi128 (__N128, 8); xmmintrin.h: __A128 =3D __builtin_ia32_pslldqi128 (__A128, 2 * 8); xmmintrin.h: __N128 =3D __builtin_ia32_pslldqi128 (__N128, 2 * 8); xmmintrin.h: __A128 =3D __builtin_ia32_pslldqi128 (__A128, 3 * 8); xmmintrin.h: __N128 =3D __builtin_ia32_pslldqi128 (__N128, 3 * 8); xmmintrin.h: __A128 =3D __builtin_ia32_pslldqi128 (__A128, 4 * 8); xmmintrin.h: __N128 =3D __builtin_ia32_pslldqi128 (__N128, 4 * 8); xmmintrin.h: __A128 =3D __builtin_ia32_pslldqi128 (__A128, 5 * 8); xmmintrin.h: __N128 =3D __builtin_ia32_pslldqi128 (__N128, 5 * 8); xmmintrin.h: __A128 =3D __builtin_ia32_pslldqi128 (__A128, 6 * 8); xmmintrin.h: __N128 =3D __builtin_ia32_pslldqi128 (__N128, 6 * 8); xmmintrin.h: __A128 =3D __builtin_ia32_pslldqi128 (__A128, 7 * 8); xmmintrin.h: __N128 =3D __builtin_ia32_pslldqi128 (__N128, 7 * 8); xmmintrin.h: __A128 =3D __builtin_ia32_pslldqi128 (__A128, 8 * 8); xmmintrin.h: __N128 =3D __builtin_ia32_pslldqi128 (__N128, 8 * 8); All the intrinsics already ensure it in this case. So, I'll repeat, don't use __builtin_ia32_* directly, they can go away any time, or change calling conventions incompatibly etc.=