[all-commits] [llvm/llvm-project] 7a41af: [X86] Support arch=x86-64{, -v2, -v3, -v4} for target...

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Aug 23 22:09:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7a41af86041bd757b7f380d7f645403d4e1725ca
      https://github.com/llvm/llvm-project/commit/7a41af86041bd757b7f380d7f645403d4e1725ca
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-08-23 (Wed, 23 Aug 2023)

  Changed paths:
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/CodeGen/CodeGenFunction.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    M clang/test/CodeGen/attr-target-clones.c
    M clang/test/CodeGen/builtin-cpu-supports.c
    M clang/test/Sema/attr-target-clones.c
    M compiler-rt/lib/builtins/cpu_model.c
    M llvm/lib/TargetParser/X86TargetParser.cpp

  Log Message:
  -----------
  [X86] Support arch=x86-64{,-v2,-v3,-v4} for target_clones attribute

GCC 12 (https://gcc.gnu.org/PR101696) allows `arch=x86-64`
`arch=x86-64-v2` `arch=x86-64-v3` `arch=x86-64-v4` in the
target_clones function attribute. This patch ports the feature.

* Set KeyFeature to `x86-64{,-v2,-v3,-v4}` in `Processors[]`, to be used
  by X86TargetInfo::multiVersionSortPriority
* builtins: change `__cpu_features2` to an array like libgcc. Define
  `FEATURE_X86_64_{BASELINE,V2,V3,V4}` and depended ISA feature bits.
* CGBuiltin.cpp: update EmitX86CpuSupports to handle `arch=x86-64*`.

Close https://github.com/llvm/llvm-project/issues/55830

Reviewed By: pengfei

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




More information about the All-commits mailing list