[PATCH] D101640: [clang][patch] Add support for option -fextend-arguments-64: widen integer arguments to int64 in unprototyped function calls

Melanie Blower via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 30 08:19:16 PDT 2021


mibintc created this revision.
mibintc added reviewers: kbsmith1, erichkeane.
mibintc added a project: clang-c.
Herald added subscribers: dexonsmith, dang, Anastasia.
mibintc requested review of this revision.
Herald added a project: clang.

The Intel C++ and Fortran compilers support the option -fextend-arguments={32,64}. One of our customers has requested that this support be added clang.  This option controls how scalar integral arguments are extended in calls to unprototyped and varargs functions. When we investigated the support for the ICL option, we discovered that "-fextend-arguments=32" had no effect in the generated code, so this patch proposes to support only 64 bit extension.  This patch is only meaningful for targets that pass int arguments in 64 bits.

For supported targets, signed int values are sign extended to 64 bits in the parameter list, and unsigned int values are zero extended to 64 bits.

@kbsmith1 tells me that this option is primarily useful for porting 32-bit programs to the 64-bit environment, and although that architecture shift happened years ago, the customer is still interested in this support.

It turns out that there is currently similar logic in clang support for the OpenCL option "cl_khr_fp64" which causes certain float arguments, in unprototyped context, to be expanded to float or double.

Will this change be acceptable?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101640

Files:
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Basic/TargetInfo.h
  clang/include/clang/Driver/Options.td
  clang/lib/Basic/Targets/X86.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/CodeGen/extend-arg-64.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101640.341912.patch
Type: text/x-patch
Size: 6104 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210430/809dca2e/attachment.bin>


More information about the cfe-commits mailing list