[all-commits] [llvm/llvm-project] 1644a3: [Clang][AArch64] Generalise streaming mode checks ...

Sander de Smalen via All-commits all-commits at lists.llvm.org
Sun Jun 16 09:24:45 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1644a31ae93177e1d046878a480ce95484882b2b
      https://github.com/llvm/llvm-project/commit/1644a31ae93177e1d046878a480ce95484882b2b
  Author: Sander de Smalen <sander.desmalen at arm.com>
  Date:   2024-06-16 (Sun, 16 Jun 2024)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Basic/arm_sve.td
    M clang/include/clang/Basic/arm_sve_sme_incl.td
    M clang/include/clang/Sema/SemaARM.h
    M clang/lib/Sema/SemaARM.cpp
    M clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_pext.c
    M clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_qrshr.c
    M clang/test/Sema/aarch64-incompat-sm-builtin-calls.c
    M clang/test/Sema/aarch64-sme-intrinsics/acle_sme_target.c
    R clang/test/Sema/aarch64-sme2-sve2p1-diagnostics.c
    A clang/test/Sema/aarch64-streaming-sme-or-nonstreaming-sve-builtins.c
    M clang/test/Sema/aarch64-sve-intrinsics/acle_sve_bfloat.cpp
    M clang/utils/TableGen/SveEmitter.cpp

  Log Message:
  -----------
  [Clang][AArch64] Generalise streaming mode checks for builtins. (#93802)

PR #76975 added 'IsStreamingOrSVE2p1' to emit a diagnostic when a builtin marked
with 'IsStreamingOrSVE2p1' is used in a non-streaming function that is not
compiled with `+sve2p1`.

The problem is a bit more complex than only this case. For example, we've marked
lots of builtins with 'IsStreamingCompatible', meaning it can be used in either
streaming, streaming-compatible or non-streaming functions. But the code in
SemaChecking, doesn't check the appropriate target guards. This issue becomes
relevant when SVE builtins are only available in streaming mode, e.g. when
compiling for SME without SVE.

If we were to add the appropriate target guards, we'd have to add many more
combinations, e.g.:
  IsStreamingSMEOrSVE
  IsStreamingSME2OrSVE2
  IsStreamingSMEOrSVE2p1
  IsStreamingSME2OrSVE2p1
  etc.

To avoid having to add more combinations (and avoid having to add more in the
future for new extensions), we use a single 'IsSVEOrStreamingSVE' flag for all
builtins that are available in streaming mode for the appropriate SME flags, or
in non-streaming mode for the appropriate SVE flags, or both.  The code in
SemaChecking will then verify for which mode (or both) the builtin would be
defined, given the target features of the function/compilation unit.

For example:

  'svclamp' is enabled under FEAT_SVE2p1 and FEAT_SME2

* When we compile for SVE2p1 and SME (but not SME2), the builtin is undefined
  behaviour when called from a streaming function.

* When we compile for SME2 and SVE2 (but not SVE2p1), the builtin is undefined
  behaviour when called from a non-streaming function.

* When we compile for _both_ SVE2p1 and SME2, the builtin can be used in either
  mode (non-streaming, streaming or streaming-compatible)



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