[PATCH] D48456: [Fixed Point Arithmetic] Casting between fixed point types and other arithmetic types

Leonard Chan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 21 14:42:27 PDT 2018


leonardchan created this revision.
leonardchan added reviewers: phosek, mcgrathr, jakehehrlich, rsmith, ebevhan.
leonardchan added a project: clang.
leonardchan added a dependency: D46917: [Fixed Point Arithmetic] Comparison and Unary Operations for Fixed Point Types.

Add support for casting between fixed point types and integer types, floating point types, or other fixed point types.

Tested casts include implicit casting during assignment, passing as a function argument, returning from a function, and an explicit C style cast.

This patch introduces 6 different cast types: fixed to int, int to fixed, fixed to float, float to fix, fixed to boolean, and fixed to fixed.

Also included are:

  - A small fix for a bug where we could parse `0k` as a fixed point literal.
  - Limit the targets tested on to x86_64-linux when checking LLVM IR. This is done to avoid not capturing extra keywords we did not expect when running these tests on other platforms. 


Repository:
  rC Clang

https://reviews.llvm.org/D48456

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/OperationKinds.def
  include/clang/AST/Type.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/TargetInfo.h
  include/clang/Lex/LiteralSupport.h
  include/clang/Sema/Sema.h
  lib/AST/ASTContext.cpp
  lib/AST/Expr.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/Type.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGExprAgg.cpp
  lib/CodeGen/CGExprComplex.cpp
  lib/CodeGen/CGExprConstant.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/Edit/RewriteObjCFoundationAPI.cpp
  lib/Lex/LiteralSupport.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaCast.cpp
  lib/Sema/SemaExpr.cpp
  lib/StaticAnalyzer/Core/ExprEngineC.cpp
  test/Frontend/fixed_point_bit_widths.c
  test/Frontend/fixed_point_conversions.c
  test/Frontend/fixed_point_declarations.c
  test/Frontend/fixed_point_errors.c
  test/Frontend/fixed_point_same_fbits.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48456.152380.patch
Type: text/x-patch
Size: 52112 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180621/c326fb72/attachment-0001.bin>


More information about the cfe-commits mailing list