[PATCH] D49219: [Sparc] Custom bitcast between f64 and v2i32

Daniel Cederman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 12 00:38:36 PDT 2018


dcederman created this revision.
dcederman added reviewers: venkatra, jyknight.
Herald added subscribers: llvm-commits, jrtc27, fedor.sergeev.

Currently bitcasting constants from f64 to v2i32 is done by storing the value to the stack and then loading it again. This is not necessary, but seems to happen because v2i32 is a valid type for Sparc V8. If it had not been legal, we would have gotten help from the type legalizer.

This patch does custom handling of bitcasts when the source is a constant or a load from memory. As both v2i32 and f64 have the same alignment we can simply switch the type when doing a load operation. For constant values we split up the float into two i32 values and build the vector from them.

I have only seen the conversion from v2i32 to f64 for inline assembly, so unless it is a load we do the standard expansion with a store and load from the stack.


Repository:
  rL LLVM

https://reviews.llvm.org/D49219

Files:
  lib/Target/Sparc/SparcISelLowering.cpp
  lib/Target/Sparc/SparcISelLowering.h
  test/CodeGen/SPARC/float-constants.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49219.155125.patch
Type: text/x-patch
Size: 4115 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180712/70ad3198/attachment.bin>


More information about the llvm-commits mailing list