public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-103098-4-5etxOsVuMV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103098-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103098

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
                 CC|                            |jakub at gcc dot gnu.org
             Status|NEW                         |RESOLVED

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
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 requires
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 handling
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 = __builtin_ia32_pslldqi128 (__A128, 8);
xmmintrin.h:      __N128 = __builtin_ia32_pslldqi128 (__N128, 8);
xmmintrin.h:      __A128 = __builtin_ia32_pslldqi128 (__A128, 2 * 8);
xmmintrin.h:      __N128 = __builtin_ia32_pslldqi128 (__N128, 2 * 8);
xmmintrin.h:      __A128 = __builtin_ia32_pslldqi128 (__A128, 3 * 8);
xmmintrin.h:      __N128 = __builtin_ia32_pslldqi128 (__N128, 3 * 8);
xmmintrin.h:      __A128 = __builtin_ia32_pslldqi128 (__A128, 4 * 8);
xmmintrin.h:      __N128 = __builtin_ia32_pslldqi128 (__N128, 4 * 8);
xmmintrin.h:      __A128 = __builtin_ia32_pslldqi128 (__A128, 5 * 8);
xmmintrin.h:      __N128 = __builtin_ia32_pslldqi128 (__N128, 5 * 8);
xmmintrin.h:      __A128 = __builtin_ia32_pslldqi128 (__A128, 6 * 8);
xmmintrin.h:      __N128 = __builtin_ia32_pslldqi128 (__N128, 6 * 8);
xmmintrin.h:      __A128 = __builtin_ia32_pslldqi128 (__A128, 7 * 8);
xmmintrin.h:      __N128 = __builtin_ia32_pslldqi128 (__N128, 7 * 8);
xmmintrin.h:      __A128 = __builtin_ia32_pslldqi128 (__A128, 8 * 8);
xmmintrin.h:      __N128 = __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.

      parent reply	other threads:[~2021-11-05 13:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 11:13 [Bug c/103098] New: " f.heckenbach@fh-soft.de
2021-11-05 11:19 ` [Bug target/103098] " pinskia at gcc dot gnu.org
2021-11-05 11:25 ` f.heckenbach@fh-soft.de
2021-11-05 13:13 ` rguenth at gcc dot gnu.org
2021-11-05 13:17 ` rguenth at gcc dot gnu.org
2021-11-05 13:42 ` jakub at gcc dot gnu.org [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103098-4-5etxOsVuMV@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).