[PATCH] D52457: [OpenCL] Implement OpenCL convert builtin

Andrew Savonichev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 25 04:10:12 PDT 2018


asavonic created this revision.
Herald added subscribers: cfe-commits, kristina, Anastasia, yaxunl.

OpenCL `convert' is a builtin that takes a builtin scalar or vector
type, and converts it to another builtin scalar or vector type using
different rounding modes (round-to-even, round-to-zero, etc.)

Previously `convert' builtin was declared in opencl-c.h header as 6284
function declarations: all combinations of types are multiplied by 10
modes.

This patch adds a single clang builtin that can codegen into any of
these 6284 builtins.

`__builtin_opencl_convert' takes 3 parameters:

1. Value to convert
2. Return type placeholder that is used to determine a result type of conversion.
3. Integer constant that denotes a rounding mode.


Repository:
  rC Clang

https://reviews.llvm.org/D52457

Files:
  include/clang/Basic/Builtins.def
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/CodeGen/CGBuiltin.cpp
  lib/Sema/SemaChecking.cpp
  test/CodeGenOpenCL/builtin-convert.cl
  test/SemaOpenCL/builtin-convert.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52457.166846.patch
Type: text/x-patch
Size: 15683 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180925/630f2f2f/attachment.bin>


More information about the cfe-commits mailing list