[all-commits] [llvm/llvm-project] 4da960: [RISCV] Add mvendorid/marchid/mimpid to CPU defini...

Pengcheng Wang via All-commits all-commits at lists.llvm.org
Fri Nov 22 07:00:04 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4da960b898f404d91109b50d423c3db400b4e9a8
      https://github.com/llvm/llvm-project/commit/4da960b898f404d91109b50d423c3db400b4e9a8
  Author: Pengcheng Wang <wangpengcheng.pp at bytedance.com>
  Date:   2024-11-22 (Fri, 22 Nov 2024)

  Changed paths:
    M llvm/include/llvm/TargetParser/RISCVTargetParser.h
    M llvm/lib/Target/RISCV/RISCVProcessors.td
    M llvm/lib/TargetParser/RISCVTargetParser.cpp
    M llvm/test/TableGen/riscv-target-def.td
    M llvm/utils/TableGen/RISCVTargetDefEmitter.cpp

  Log Message:
  -----------
  [RISCV] Add mvendorid/marchid/mimpid to CPU definitions (#116202)

We can get these information via `sys_riscv_hwprobe`.

This can be used to implement `__builtin_cpu_is`.


  Commit: 875b10f7d0888ca7e53f527f4c30531bd6b50bfb
      https://github.com/llvm/llvm-project/commit/875b10f7d0888ca7e53f527f4c30531bd6b50bfb
  Author: Pengcheng Wang <wangpengcheng.pp at bytedance.com>
  Date:   2024-11-22 (Fri, 22 Nov 2024)

  Changed paths:
    M clang/lib/Basic/Targets/RISCV.cpp
    M clang/lib/Basic/Targets/RISCV.h
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    A clang/test/CodeGen/RISCV/builtin-cpu-is-error.c
    A clang/test/CodeGen/RISCV/builtin-cpu-is.c
    M clang/test/Preprocessor/has_builtin_cpuid.c
    M llvm/include/llvm/TargetParser/RISCVTargetParser.h
    M llvm/lib/TargetParser/RISCVTargetParser.cpp

  Log Message:
  -----------
  [RISCV] Support __builtin_cpu_is

We have defined `__riscv_cpu_model` variable in #101449. It contains
`mvendorid`, `marchid` and `mimpid` fields which are read via system
call `sys_riscv_hwprobe`.

We can support `__builtin_cpu_is` via comparing values in compiler's
CPU definitions and `__riscv_cpu_model`.

This depends on #116202.

Reviewers: lenary, BeMg, kito-cheng, preames, lukel97

Reviewed By: lenary

Pull Request: https://github.com/llvm/llvm-project/pull/116231


Compare: https://github.com/llvm/llvm-project/compare/14bdcefbd88f...875b10f7d088

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