[all-commits] [llvm/llvm-project] e3db5e: [clang][LoongArch] Check target features in CheckL...

lrzlin via All-commits all-commits at lists.llvm.org
Sun Apr 19 19:33:31 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e3db5e0cb17199bcb30fba51ff6cf58094fa1f7c
      https://github.com/llvm/llvm-project/commit/e3db5e0cb17199bcb30fba51ff6cf58094fa1f7c
  Author: lrzlin <linrunze at loongson.cn>
  Date:   2026-04-20 (Mon, 20 Apr 2026)

  Changed paths:
    M clang/lib/Sema/SemaLoongArch.cpp
    A clang/test/Sema/builtin-loongarch-check-target-feature.cpp

  Log Message:
  -----------
  [clang][LoongArch] Check target features in CheckLoongArchBuiltinFunctionCall (#191811)

Add target features check in `CheckLoongArchBuiltinFunctionCall`, thus
we could through an error
when pass the `-mno-lsx` to clang while using the builtin LSX intrinsics
for global variables instead of
trigger an ICE.

Minimal Example:
```
// clang-20 --march=loongarch64 -mno-lsx -S -o - "x.cc"
__attribute__((__vector_size__(16))) long foo = __builtin_lsx_vinsgr2vr_w(foo, 0, 0);
```
and the compiler will output
```
x.cc:1:49: error: builtin needs target feature lsx
    1 | __attribute__((__vector_size__(16))) long foo = __builtin_lsx_vinsgr2vr_w(foo, 0, 0);
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```

Fix https://github.com/llvm/llvm-project/issues/131771



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list