Page MenuHomePhabricator

[OpenCL] Implement OpenCL convert builtin
Needs ReviewPublic

Authored by asavonic on Sep 25 2018, 4:10 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

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.

Diff Detail