[PATCH] D142948: [OpenCL] Disable vector to scalar types coercion for OpenCL

Chunyang, Dai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 30 18:44:48 PST 2023


cdai2 created this revision.
Herald added subscribers: Naghasan, ldrumm, pengfei, Anastasia, yaxunl.
Herald added a project: All.
cdai2 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

For x86 target, vector types (both result and arguments) can be coerced
to scalars of the same size, e.g:

  define zeroext i1 @_Z18convert_ulong4_rteDv4_t(<4 x i16> %x)
  ; becomes
  define zeroext i1 @_Z18convert_ulong4_rteDv4_t(i64 %x.coerced)

Such behavior is completely valid for x86, but the backend vectorizer
cannot work with scalars instead of vectors.

With this patch, argument and result types will be leaved unchanged in
the CodeGen.

New option fopencl-force-vector-abi is also added to force-disables
vector to scalar coercion when provided.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142948

Files:
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGenOpenCL/vector-to-scalar-coercion.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142948.493468.patch
Type: text/x-patch
Size: 6342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230131/e55c301d/attachment.bin>


More information about the cfe-commits mailing list