llvm-project/clang/test/Sema/convertvector.c
Pol Marcet Sardà 2903df02fb Squashed commit of the following:
commit 8d41d93e3fceb3f3af77266f5a8388fc585150a5
Author: Pol Marcet Sardà <polmarcetsarda@gmail.com>
Date:   Sat Apr 20 12:19:49 2024 +0200

    Address some misc comments; added a diagnostic and expanded macros in
    testing.

commit 9493c0f290b558947d8b3ae8e1adf909b0fb9dcd
Author: Pol Marcet Sardà <polmarcetsarda@gmail.com>
Date:   Sun Mar 31 18:18:45 2024 +0200

    Following the review of sethp, I have made the following changes:

    -- Added diagnostic for the undefined shuffle of -1
    -- Validated support for _BitInt
    -- A bunch of other minnor tweaks here and there

commit 8273abc8d56ef8225cf4dba84f66a1e54a2ef036
Author: Pol Marcet Sardà <polmarcetsarda@gmail.com>
Date:   Thu Jan 4 12:31:08 2024 +0100

    Fix typo in file name

commit ff68f23921966c7d9605f91a47d6b481bf1d7a7b
Author: Pol Marcet Sardà <polmarcetsarda@gmail.com>
Date:   Thu Jan 4 11:26:08 2024 +0100

    Address suggestions from RKSimon

commit c14783de45687c754253c0cbf8a7834c7f986d80
Author: Pol Marcet Sardà <polmarcetsarda@gmail.com>
Date:   Sat Dec 30 13:59:00 2023 +0100

    [clang] Constexpr for __builtin_shufflevector and __builtin_convertvector

    Summary:

    This patch adds constexpr support for __builtin_shufflevector
    and __builtin_convertvector.

    A small oddity encountered was that the arg to the intrinsics may be an
    lvalue without any sort of implicit cast of any kind. I solved this
    through the EvaluateVectorOrLValue function, which treats the lvalue as
    if it was in an rvalue cast, which gets me the desired vector.

Co-Authored-By: Seth Pellegrino <seth@codecopse.net>
2024-04-29 09:09:59 -07:00

21 lines
757 B
C

// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef double vector4double __attribute__((__vector_size__(32)));
typedef float vector8float __attribute__((__vector_size__(32)));
vector8float foo1(vector4double x) {
return __builtin_convertvector(x, vector8float); // expected-error {{same number of elements}}
}
float foo2(vector4double x) {
return __builtin_convertvector(x, float); // expected-error {{second argument to __builtin_convertvector must be of vector type}}
}
vector8float foo3(double x) {
return __builtin_convertvector(x, vector8float); // expected-error {{must be a vector}}
}
float foo4(float x) {
return __builtin_convertvector(x, float); // expected-error {{first argument to __builtin_convertvector must be a vector}}
}