public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/103098] New: bogus error: the last argument must be an 8-bit immediate
@ 2021-11-05 11:13 f.heckenbach@fh-soft.de
  2021-11-05 11:19 ` [Bug target/103098] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: f.heckenbach@fh-soft.de @ 2021-11-05 11:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103098
           Summary: bogus error: the last argument must be an 8-bit
                    immediate
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: f.heckenbach@fh-soft.de
  Target Milestone: ---

% cat t.c
long long int __attribute__ ((__vector_size__ (16))) a;

int main (void)
{
  a = __builtin_ia32_pslldqi128 (a, 1);
}
% gcc t.c
t.c: In function 'main':
t.c:5:7: error: the last argument must be an 8-bit immediate
   a = __builtin_ia32_pslldqi128 (a, 1);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/103098] bogus error: the last argument must be an 8-bit immediate
  2021-11-05 11:13 [Bug c/103098] New: bogus error: the last argument must be an 8-bit immediate f.heckenbach@fh-soft.de
@ 2021-11-05 11:19 ` pinskia at gcc dot gnu.org
  2021-11-05 11:25 ` f.heckenbach@fh-soft.de
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-05 11:19 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Don't use the builtin directly as it is not documented.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/103098] bogus error: the last argument must be an 8-bit immediate
  2021-11-05 11:13 [Bug c/103098] New: bogus error: the last argument must be an 8-bit immediate 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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: f.heckenbach@fh-soft.de @ 2021-11-05 11:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Frank Heckenbach <f.heckenbach@fh-soft.de> ---
https://gcc.gnu.org/onlinedocs/gcc/x86-Built-in-Functions.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/103098] bogus error: the last argument must be an 8-bit immediate
  2021-11-05 11:13 [Bug c/103098] New: bogus error: the last argument must be an 8-bit immediate 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
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-05 13:13 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-11-05
             Status|UNCONFIRMED                 |NEW
             Target|                            |x86_64-*-* i?86-*-*
           Keywords|                            |rejects-valid

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  We end in the

    case V2DI_FTYPE_V2DI_INT_CONVERT:
      nargs = 2;
      rmode = V1TImode;
      nargs_constant = 1;
      break;

case, where nargs_constant looks wrong, but maybe I misunderstand it (it isn't
documented - number of args or argument at position?)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/103098] bogus error: the last argument must be an 8-bit immediate
  2021-11-05 11:13 [Bug c/103098] New: bogus error: the last argument must be an 8-bit immediate f.heckenbach@fh-soft.de
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-05 13:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Of course

BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_sse2_ashlv1ti3,
"__builtin_ia32_pslldqi128", IX86_BUILTIN_PSLLDQI128, UNKNOWN, (int)
V2DI_FTYPE_V2DI_INT_CONVERT)

looks suspicious, ashlv1ti3 doesn't sound like involving V2DI ...
possibly a V1TI_FTYPE_V1TI_SI_COUNT type is simply missing.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/103098] bogus error: the last argument must be an 8-bit immediate
  2021-11-05 11:13 [Bug c/103098] New: bogus error: the last argument must be an 8-bit immediate f.heckenbach@fh-soft.de
                   ` (3 preceding siblings ...)
  2021-11-05 13:17 ` rguenth at gcc dot gnu.org
@ 2021-11-05 13:42 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-11-05 13:42 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-05 13:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 11:13 [Bug c/103098] New: bogus error: the last argument must be an 8-bit immediate 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 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).