Commit Graph

3810 Commits

Author SHA1 Message Date
Cullen Rhodes f9091e56d3 [clang][aarch64] Drop experimental from __ARM_FEATURE_SVE_BITS macro
The __ARM_FEATURE_SVE_BITS feature macro is specified in the Arm C
Language Extensions (ACLE) for SVE [1] (version 00bet5). From the spec,
where __ARM_FEATURE_SVE_BITS==N:

    When N is nonzero, indicates that the implementation is generating
    code for an N-bit SVE target and that the arm_sve_vector_bits(N)
    attribute is available.

This was defined in D83550 as __ARM_FEATURE_SVE_BITS_EXPERIMENTAL and
enabled under the -msve-vector-bits flag to simplify initial tests.
This patch drops _EXPERIMENTAL now there is support for the feature.

[1] https://developer.arm.com/documentation/100987/latest

Reviewed By: david-arm

Differential Revision: https://reviews.llvm.org/D86720
2020-09-03 09:39:37 +00:00
Richard Smith 0ffbbce78d Don't take the expression range into account when looking for widening
of a unary - expression.

This fixes an issue where we'd produce bogus diagnostics, and also
should recover ~0.3% compile time.
2020-09-01 17:42:12 -07:00
Richard Smith f819dbf012 Classify (small unsigned bitfield) < 0 comparisons under
-Wtautological-unsigned-zero-compare not under
-Wtautological-value-range-compare.
2020-08-31 23:16:48 -07:00
Richard Smith cff6dda604 More accurately compute the ranges of possible values for +, -, *, &, %.
Continue to heuristically pick the wider of the two operands for
narrowing conversion warnings so that some_char + 1 isn't treated as
being wider than a char, but use the more accurate computation for
tautological comparison warnings.

Differential Revision: https://reviews.llvm.org/D85778
2020-08-31 23:16:48 -07:00
Cullen Rhodes feed5a7239 [Sema][AArch64] Support arm_sve_vector_bits attribute
This patch implements the semantics for the 'arm_sve_vector_bits' type
attribute, defined by the Arm C Language Extensions (ACLE) for SVE [1].
The purpose of this attribute is to define vector-length-specific (VLS)
versions of existing vector-length-agnostic (VLA) types.

The semantics were already implemented by D83551, although the
implementation approach has since changed to represent VLSTs as
VectorType in the AST and fixed-length vectors in the IR everywhere
except in function args/returns. This is described in the prototype
patch D85128 demonstrating the new approach.

The semantic changes added in D83551 are changed since the
AttributedType is replaced by VectorType in the AST. Minimal changes
were necessary in the previous patch as the canonical type for both VLA
and VLS was the same (i.e. sizeless), except in constructs such as
globals and structs where sizeless types are unsupported. This patch
reverts the changes that permitted VLS types that were represented as
sizeless types in such circumstances, and adds support for implicit
casting between VLA <-> VLS types as described in section 3.7.3.2 of the
ACLE.

Since the SVE builtin types for bool and uint8 are both represented as
BuiltinType::UChar in VLSTs, two new vector kinds are implemented to
distinguish predicate and data vectors.

[1] https://developer.arm.com/documentation/100987/latest

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D85736
2020-08-27 10:38:32 +00:00
Simon Pilgrim e7d9182a66 Enable constexpr on BITREVERSE builtin intrinsics (PR47249)
This enables us to use the __builtin_bitreverse 8/16/32/64 intrinsics inside constexpr code.

Differential Revision: https://reviews.llvm.org/D86339
2020-08-22 14:43:22 +01:00
Simon Pilgrim 2ceac91ec0 Enable constexpr on ROTATELEFT/ROTATERIGHT builtin intrinsics (PR47249)
This enables us to use the __builtin_rotateleft / __builtin_rotateright 8/16/32/64 intrinsics inside constexpr code.

Differential Revision: https://reviews.llvm.org/D86342
2020-08-22 14:43:21 +01:00
Craig Topper 724f570ad2 [X86] Add support 'tune' in target attribute
This adds parsing and codegen support for tune in target attribute.

I've implemented this so that arch in the target attribute implicitly disables tune from the command line. I'm not sure what gcc does here. But since -march implies -mtune. I assume 'arch' in the target attribute implies tune in the target attribute.

Differential Revision: https://reviews.llvm.org/D86187
2020-08-19 15:58:19 -07:00
Richard Smith 6f33936719 Explain why the array bound is non-constant in VLA diagnostics.
In passing, also use a more precise diagnostic to explain why an
expression is not an ICE if it's not of integral type.
2020-08-19 15:45:51 -07:00
Jon Chesterfield bcaa806a47 [Clang] Fix BZ47169, loader_uninitialized on incomplete types
[Clang] Fix BZ47169, loader_uninitialized on incomplete types

Reported by @erichkeane. Fix proposed by @erichkeane works, tests included.
Bug introduced in D74361. Crash was on querying a CXXRecordDecl for
hasTrivialDefaultConstructor on an incomplete type. Fixed by calling
RequireCompleteType in the right place.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D85990
2020-08-19 18:11:50 +01:00
Mott, Jeffrey T ca77ab494a Disable use of _ExtInt with '__atomic' builtins
We're (temporarily) disabling ExtInt for the '__atomic' builtins so we can better design their behavior later. The idea is until we do an audit/design for the way atomic builtins are supposed to work with _ExtInt, we should leave them restricted so they don't limit our future options, such as by binding us to a sub-optimal implementation via ABI.

Example after this change:

    $ cat test.c

        void f(_ExtInt(64) *ptr) {
          __atomic_fetch_add(ptr, 1, 0);
        }

    $ clang -c test.c

        test.c:2:22: error: argument to atomic builtin of type '_ExtInt' is not supported
          __atomic_fetch_add(ptr, 1, 0);
                             ^
        1 error generated.

Differential Revision: https://reviews.llvm.org/D84049
2020-08-18 09:17:26 -07:00
Dávid Bolvanský 2f7adf5ee3 [Diagnostics] Skip var decl of structs for -Wstring-concatenation 2020-08-13 20:20:26 +02:00
Michael Forster a5b8757506 Introduce ns_error_domain attribute.
ns_error_domain can be used by, e.g. NS_ERROR_ENUM, in order to
identify a global declaration representing the domain constant.

Introduces the attribute, Sema handling, diagnostics, and test case.

This is cherry-picked from a14779f504
and adapted to updated Clang APIs.

Reviewed By: gribozavr2, aaron.ballman

Differential Revision: https://reviews.llvm.org/D84005
2020-08-13 15:05:12 +02:00
Aleksandr Platonov 3fa0a039ab [clang] Check `expr` inside `InitListChecker::UpdateStructuredListElement()`
- Prevent nullptr-deference at try to emit warning for invalid `expr`
- Simplify `InitListChecker::UpdateStructuredListElement()` usages. We do not need to check `expr` and increment `StructuredIndex` (for invalid `expr`) before the call anymore.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D85193
2020-08-12 22:12:43 +03:00
Dávid Bolvanský b9af72bffe [Diagnostics] Reworked -Wstring-concatenation 2020-08-12 02:18:01 +02:00
Dávid Bolvanský 4b59dc77dc [Diagnostics] Ignore structs and long text for -Wstring-concatenation 2020-08-11 00:49:58 +02:00
Dávid Bolvanský b2c9b631bb [Diagnostics] Move -Wstring-concatenation to -Wextra 2020-08-10 23:36:33 +02:00
Dávid Bolvanský 62223ff137 [Diagnostics] Avoid false positives with -Wstring-concatenation 2020-08-10 23:05:01 +02:00
Dávid Bolvanský 975467e4aa [Diagnostics] Handle string concat pattern and avoid false positives 2020-08-09 16:02:41 +02:00
Dávid Bolvanský 04a23f1fe0 [Diagnostics] Turn string concat warning to avoid false positives 2020-08-09 12:22:29 +02:00
Dávid Bolvanský 6cd23558d3 [Clang] Fixed buildboit failure; bot defaults to older C++ standard 2020-08-08 19:37:50 +02:00
Dávid Bolvanský dc096a66cb [Diagnostics] Diagnose missing comma in string array initialization
Motivation (from PR37674):

const char *ss[] = {
  "foo", "bar",
  "baz", "qux"  // <-- Missing comma!
  "abc", "xyz"
  };

This kind of bug was recently also found in LLVM codebase (see PR47030).

Solves PR47038, PR37674

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D85545
2020-08-08 19:24:30 +02:00
Vince Bridgers 351aac0985 [Sema] Add casting check for fixed to fixed point conversions
This change squelches the warning for a cast from fixed to fixed point
conversions when -Wbad-function-cast is enabled.

Fixes:

cast from function call of type '_Fract' to non-matching type '_Fract'
[-Wbad-function-cast]

Reviewed By: bjope

Differential Revision: https://reviews.llvm.org/D85157
2020-08-07 07:58:53 -05:00
Simon Tatham 1d78294250 [Sema][BFloat] Forbid arithmetic on vectors of bfloat.
Vectors of bfloat are a storage format only; you're supposed to
explicitly convert them to a wider type to do arithmetic on them.
But currently, if you write something like

  bfloat16x4_t test(bfloat16x4_t a, bfloat16x4_t b) { return a + b; }

then the clang frontend accepts it without error, and (ARM or AArch64)
isel fails to generate code for it.

Added a rule in Sema that forbids the attempt from even being made,
and tests that check it. In particular, we also outlaw arithmetic
between vectors of bfloat and any other vector type.

Patch by Luke Cheeseman.

Reviewed By: LukeGeeson

Differential Revision: https://reviews.llvm.org/D85009
2020-08-07 11:25:19 +01:00
Richard Smith d6492d8744 Add -Wtautological-value-range-compare warning.
This warning diagnoses cases where an expression is compared to a
constant, and the comparison is tautological due to the form of the
expression (but not merely due to its type). This applies in cases such
as comparisons of bit-fields and the result of bit-masks.

The new warning is added to the Clang diagnostic group
-Wtautological-constant-in-range-compare but not to the
formerly-equivalent GCC-compatibility diagnostic group -Wtype-limits,
which retains its old meaning of diagnosing only tautological
comparisons to extremal values of a type (eg, int > INT_MAX).

Reviewed By: rtrieu

Differential Revision: https://reviews.llvm.org/D85256
2020-08-06 13:28:50 -07:00
Yonghong Song 6d67506964 [clang][BPF] support type exist/size and enum exist/value relocations
This patch added the following additional compile-once
run-everywhere (CO-RE) relocations:
  - existence/size of typedef, struct/union or enum type
  - enum value and enum value existence

These additional relocations will make CO-RE bpf programs more
adaptive for potential kernel internal data structure changes.

For existence/size relocations, the following two code patterns
are supported:
  1. uint32_t __builtin_preserve_type_info(*(<type> *)0, flag);
  2. <type> var;
     uint32_t __builtin_preserve_field_info(var, flag);
flag = 0 for existence relocation and flag = 1 for size relocation.

For enum value existence and enum value relocations, the following code
pattern is supported:
  uint64_t __builtin_preserve_enum_value(*(<enum_type> *)<enum_value>,
                                         flag);
flag = 0 means existence relocation and flag = 1 for enum value.
relocation. In the above <enum_type> can be an enum type or
a typedef to enum type. The <enum_value> needs to be an enumerator
value from the same enum type. The return type is uint64_t to
permit potential 64bit enumerator values.

Differential Revision: https://reviews.llvm.org/D83242
2020-08-04 08:39:53 -07:00
Erich Keane 0a8ac91a08 Permit nowthrow and nonnull with multiversioning.
Some shipped versions of stdlib.h use nonnull and nothrow with function
multiversioning.  Support these, as they are generally harmless.
2020-08-04 07:40:27 -07:00
Erich Keane 961da69d7e Improve diagnostics for disallowed attributes used with multiversioning
Since we permit using SOME attributes (at the moment, just 1) with
multiversioning, we should improve the message as it still implies that
no attributes should be combined with multiversioning.
2020-08-04 07:40:27 -07:00
Bruno Ricci b0512eed1e
[clang][NFC] Add a test for __attribute__((flag_enum)) with an unnamed enumeration. 2020-07-26 17:24:43 +01:00
Richard Smith 6c18f7db73 For PR46800, implement the GCC __builtin_complex builtin.
glibc's implementation of the CMPLX macro uses it (with -fgnuc-version
set to 4.7 or later).
2020-07-22 13:43:10 -07:00
Cullen Rhodes 89e61e782b [Sema][AArch64] Add semantics for arm_sve_vector_bits attribute
Summary:
This patch implements semantics for the 'arm_sve_vector_bits' type
attribute, defined by the Arm C Language Extensions (ACLE) for SVE [1].
The purpose of this attribute is to define fixed-length (VLST) versions
of existing sizeless types (VLAT).

Implemented in this patch is the the behaviour described in section 3.7.3.2
and minimal parts of sections 3.7.3.3 and 3.7.3.4, this includes:

    * Defining VLST globals, structs, unions, and local variables
    * Implicit casting between VLAT <=> VLST.
    * Diagnosis of ill-formed conditional expressions of the form:

        C ?  E1 : E2

      where E1 is a VLAT type and E2 is a VLST, or vice-versa. This
      avoids any ambiguity about the nature of the result type (i.e is
      it sized or sizeless).
    * For vectors:
        * sizeof(VLST) == N/8
        * alignof(VLST) == 16
    * For predicates:
        * sizeof(VLST) == N/64
        * alignof(VLST) == 2

VLSTs have the same representation as VLATs in the AST but are wrapped
with a TypeAttribute. Scalable types are currently emitted in the IR for
uses such as globals and structs which don't support these types, this
is addressed in the next patch with codegen, where VLSTs are lowered to
sized arrays for globals, structs / unions and arrays.

Not implemented in this patch is the behaviour guarded by the feature
macros:

    * __ARM_FEATURE_SVE_VECTOR_OPERATORS
    * __ARM_FEATURE_SVE_PREDICATE_OPERATORS

As such, the GNU __attribute__((vector_size)) extension is not available
and operators such as binary '+' are not supported for VLSTs. Support
for this is intended to be addressed by later patches.

[1] https://developer.arm.com/documentation/100987/latest

This is patch 2/4 of a patch series.

Reviewers: sdesmalen, rsandifo-arm, efriedma, cameron.mcinally, ctetreau, rengolin, aaron.ballman

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D83551
2020-07-22 16:26:23 +00:00
David Goldman dde98c82c0 Fix issue in typo handling which could lead clang to hang
Summary:
We need to detect when certain TypoExprs are not being transformed
due to invalid trees, otherwise we risk endlessly trying to fix it.

Reviewers: rsmith

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D84067
2020-07-20 11:42:11 -04:00
Erich Keane 66aff32398 Issue error on invalid arithemtic conversions in C ternary
As reported in PR46774, an invalid arithemetic conversion used in a C
ternary operator resulted in an assertion. This patch replaces that
assertion with a diagnostic stating that the conversion failed.

At the moment, I believe the only case of this happening is _ExtInt
types.
2020-07-20 08:02:37 -07:00
Bruno Ricci acf3bdc283
[clang][NFC] Tests showing the problems with some uses of NamedDecl::getDeclName in diagnostics, SemaOverload.cpp+SemaStmt.cpp part 2020-07-18 20:44:06 +01:00
Yaxun (Sam) Liu 9275e14379 recommit 4fc752b30b [CUDA][HIP] Always defer diagnostics for wrong-sided reference
Fixed regression in test builtin-amdgcn-atomic-inc-dec-failure.cpp.
2020-07-17 09:14:39 -04:00
Cullen Rhodes bb160e769d [Sema][AArch64] Add parsing support for arm_sve_vector_bits attribute
Summary:

This patch implements parsing support for the 'arm_sve_vector_bits' type
attribute, defined by the Arm C Language Extensions (ACLE, version 00bet5,
section 3.7.3) for SVE [1].

The purpose of this attribute is to define fixed-length (VLST) versions
of existing sizeless types (VLAT). For example:

    #if __ARM_FEATURE_SVE_BITS==512
    typedef svint32_t fixed_svint32_t __attribute__((arm_sve_vector_bits(512)));
    #endif

Creates a type 'fixed_svint32_t' that is a fixed-length version of
'svint32_t' that is normal-sized (rather than sizeless) and contains
exactly 512 bits. Unlike 'svint32_t', this type can be used in places
such as structs and arrays where sizeless types can't.

Implemented in this patch is the following:

  * Defined and tested attribute taking single argument.
  * Checks the argument is an integer constant expression.
  * Attribute can only be attached to a single SVE vector or predicate
    type, excluding tuple types such as svint32x4_t.
  * Added the `-msve-vector-bits=<bits>` flag. When specified the
    `__ARM_FEATURE_SVE_BITS__EXPERIMENTAL` macro is defined.
  * Added a language option to store the vector size specified by the
    `-msve-vector-bits=<bits>` flag. This is used to validate `N ==
    __ARM_FEATURE_SVE_BITS`, where N is the number of bits passed to the
    attribute and `__ARM_FEATURE_SVE_BITS` is the feature macro defined under
    the same flag.

The `__ARM_FEATURE_SVE_BITS` macro will be made non-experimental in the final
patch of the series.

[1] https://developer.arm.com/documentation/100987/latest

This is patch 1/4 of a patch series.

Reviewers: sdesmalen, rsandifo-arm, efriedma, ctetreau, cameron.mcinally, rengolin, aaron.ballman

Reviewed By: sdesmalen, aaron.ballman

Differential Revision: https://reviews.llvm.org/D83550
2020-07-17 10:06:54 +00:00
Mott, Jeffrey T d083adb068 Prohibit use of _ExtInt in atomic intrinsic
The _ExtInt type allows custom width integers, but the atomic memory
access's operand must have a power-of-two size. _ExtInts with
non-power-of-two size should not be allowed for atomic intrinsic.

Before this change:

$ cat test.c

typedef unsigned _ExtInt(42) dtype;
void verify_binary_op_nand(dtype* pval1, dtype val2)
{    __sync_nand_and_fetch(pval1, val2); }

$ clang test.c

clang-11:
/home/ubuntu/llvm_workspace/llvm/clang/lib/CodeGen/CGBuiltin.cpp:117:
llvm::Value*
EmitToInt(clang::CodeGen::CodeGenFunction&, llvm::Value*,
clang::QualType, llvm::IntegerType*): Assertion `V->getType() ==
IntType' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the
crash backtrace, preprocessed source, and associated run script.

After this change:

$ clang test.c

test.c:3:30: error: Atomic memory operand must have a power-of-two size
{    __sync_nand_and_fetch(pval1, val2); }
^

List of the atomic intrinsics that have this
problem:

__sync_fetch_and_add
__sync_fetch_and_sub
__sync_fetch_and_or
__sync_fetch_and_and
__sync_fetch_and_xor
__sync_fetch_and_nand
__sync_nand_and_fetch
__sync_and_and_fetch
__sync_add_and_fetch
__sync_sub_and_fetch
__sync_or_and_fetch
__sync_xor_and_fetch
__sync_fetch_and_min
__sync_fetch_and_max
__sync_fetch_and_umin
__sync_fetch_and_umax
__sync_val_compare_and_swap
__sync_bool_compare_and_swap

Differential Revision: https://reviews.llvm.org/D83340
2020-07-14 06:11:04 -07:00
Aaron Ballman 006c49d890 Change behavior with zero-sized static array extents
Currently, Clang previously diagnosed this code by default:
  void f(int a[static 0]);
saying that "static has no effect on zero-length arrays", which was
accurate.

However, static array extents require that the caller of the function
pass a nonnull pointer to an array of *at least* that number of
elements, but it can pass more (see C17 6.7.6.3p6). Given that we allow
zero-sized arrays as a GNU extension and that it's valid to pass more
elements than specified by the static array extent, we now support
zero-sized static array extents with the usual semantics because it can
be useful in cases like:

  void my_bzero(char p[static 0], int n);
  my_bzero(&c+1, 0); //ok
  my_bzero(t+k,n-k); //ok, pattern from actual code
2020-07-10 15:58:11 -04:00
Erik Pilkington dafc3106d2 [Sema] Emit a -Wformat warning for printf("%s", (void*)p)
Its dangerous to assume that the opaque pointer points to a null-terminated
string, and this has an easy fix (casting to char*).

rdar://62432331
2020-07-10 15:10:24 -04:00
Zhi Zhuang 4d4d903767 Fix warning caused by __builtin_expect_with_probability was not handled
in places such as constant folding

Previously some places that should have handled
__builtin_expect_with_probability is missing, so in some case it acts
differently than __builtin_expect.
For example it was not handled in constant folding, thus in the
following program, the "if" condition should be constantly true and
folded, but previously it was not handled and cause warning "control may
reach end of non-void function" (while __builtin_expect does not):

__attribute__((noreturn)) extern void bar();
int foo(int x, int y) {
  if (y) {
    if (__builtin_expect_with_probability(1, 1, 1))
      bar();
  }
  else
    return 0;
}

Now it's fixed.

Differential Revisions: https://reviews.llvm.org/D83362
2020-07-09 08:01:33 -07:00
Aleksandr Platonov 1ba6fb9293
[clang] Fix a crash when passing a C structure of incompatible type to a function with a reference parameter.
__builtin_va_*() and __builtin_ms_va_*() are declared as functions with a
parameter of reference type.

This patch fixes a crash when using these functions in C where an argument
of structure type is incompatible with the parameter type.

Differential Revision: https://reviews.llvm.org/D82805

Reviewed By: riccibruno

Patch by: Aleksandr Platonov <platonov.aleksandr@huawei.com>
2020-07-08 16:57:54 +01:00
Saiyedul Islam 0882c9d4fc [AMDGPU] Change Clang AMDGCN atomic inc/dec builtins to take unsigned values
builtin_amdgcn_atomic_inc32(uint *Ptr, uint Val, unsigned MemoryOrdering, const char *SyncScope)
builtin_amdgcn_atomic_inc64(uint64_t *Ptr, uint64_t Val, unsigned MemoryOrdering, const char *SyncScope)
builtin_amdgcn_atomic_dec32(uint *Ptr, uint Val, unsigned MemoryOrdering, const char *SyncScope)
builtin_amdgcn_atomic_dec64(uint64_t *Ptr, uint64_t Val, unsigned MemoryOrdering, const char *SyncScope)

As AMDGCN IR instrinsic for atomic inc/dec does unsigned comparison,
these clang builtins should also take unsigned types instead of signed
int types.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D83121
2020-07-07 06:36:25 +00:00
Haojian Wu cd9a241f16 [clang] Fix the incorrect dependence bits for DependentExtIntType.
The error-bit was missing, and the unexpandedpack bit seemed to be
set incorrectly.

Reviewed By: sammccall, erichkeane

Differential Revision: https://reviews.llvm.org/D83114
2020-07-06 16:42:56 +02:00
Dmitry Preobrazhensky 53422e8b4f [AMDGPU] Added support of new inline assembler constraints
Added support for constraints 'I', 'J', 'L', 'B', 'C', 'Kf', 'DA', 'DB'.

See https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html#Machine-Constraints.

Reviewers: arsenm, rampitec

Differential Revision: https://reviews.llvm.org/D81657
2020-07-03 18:01:12 +03:00
Haojian Wu d28267f981 [AST][RecoveryExpr] Add error-bit to NestNameSpecifierDependence and TemplateNameDependence.
Summary:
We might lose the error-bit if the error-bit goes through the code path
"error type/expr" -> "error template argument" -> "nested name specifier" ->
... -> "template Specialization type"

Template name also needs this, as a template can be nested into
an error specifier, e.g. templateName apply in
`TC<decltype(<recovery-expr>(Foo, int()))>::template apply`

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82526
2020-06-30 11:56:24 +02:00
Cullen Rhodes 1ef75f53e9 [AArch64][SVE] clang: Add missing svbfloat16_t tests
Summary:
Patch adds tests for mangling of svbfloat16_t and several other type
related tests.

Reviewers: sdesmalen, kmclaughlin, fpetrogalli, efriedma

Reviewed By: sdesmalen, fpetrogalli

Differential Revision: https://reviews.llvm.org/D82668
2020-06-29 16:48:53 +00:00
Aaron Ballman 37657991d1 Fix a crash with [[clang::acquire_handle]] when written as a type
attribute with no arguments provided.
2020-06-25 08:45:32 -04:00
Florian Hahn 043b608399 [Matrix] Use 1st/2nd instead of first/second in matrix diags.
This was suggested in D72782 and brings the diagnostics more in line
with how argument references are handled elsewhere.

Reviewers: rjmccall, jfb, Bigcheese

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D82473
2020-06-25 11:55:03 +01:00
Mikhail Maltsev 3f353a2e5a [BFloat] Add convert/copy instrinsic support
This patch is part of a series implementing the Bfloat16 extension of the Armv8.6-a architecture, as detailed here:

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a

Specifically it adds intrinsic support in clang and llvm for Arm and AArch64.

The bfloat type, and its properties are specified in the Arm Architecture Reference Manual:

https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile

The following people contributed to this patch:
  - Alexandros Lamprineas
  - Luke Cheeseman
  - Mikhail Maltsev
  - Momchil Velikov
  - Luke Geeson

Differential Revision: https://reviews.llvm.org/D80928
2020-06-23 14:27:05 +00:00
Zhi Zhuang 37fb860301 Add support of __builtin_expect_with_probability
Add a new builtin-function __builtin_expect_with_probability and
intrinsic llvm.expect.with.probability.
The interface is __builtin_expect_with_probability(long expr, long
expected, double probability).
It is mainly the same as __builtin_expect besides one more argument
indicating the probability of expression equal to expected value. The
probability should be a constant floating-point expression and be in
range [0.0, 1.0] inclusive.
It is similar to builtin-expect-with-probability function in GCC
built-in functions.

Differential Revision: https://reviews.llvm.org/D79830
2020-06-22 10:21:28 -07:00