[PATCH] D26767: [AMDGPU] Promote f16/i16 conversions to f32/i32 + custom lower f16 = fp_round f64

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 15:06:46 PST 2016


arsenm added inline comments.


================
Comment at: lib/Target/AMDGPU/SIISelLowering.cpp:3664-3668
+  case ISD::BITCAST: {
+    if (N->getValueType(0) == N->getOperand(0).getValueType())
+      return N->getOperand(0);
+    break;
+  }
----------------
kzhuravl wrote:
> arsenm wrote:
> > kzhuravl wrote:
> > > arsenm wrote:
> > > > kzhuravl wrote:
> > > > > arsenm wrote:
> > > > > > This should be very unnecessary
> > > > > I am getting a "cannot select: i16 = bitcast i16". Do you have a suggestion on how to solve it?
> > > > > 
> > > > > Thanks
> > > > Where is that coming from? I thought getNode folded out trivial bitcasts like this already
> > > It is coming right after:
> > > https://github.com/llvm-mirror/llvm/blob/master/lib/Target/AMDGPU/AMDGPUISelLowering.cpp#L2100
> > > 
> > > in the optimized dag phase
> > I don't see how that would create a bitcast, or create one that somehow bypasses the no-op fold
> It gets inserted in legalize phase, when legalizing `fp_round`:
> ```
>   t16: f16 = fp_round t14, TargetConstant:i32<0>
> t19: i16 = bitcast t16
> ```
> 
> Then `fp_round` gets legalized to `(truncate to i16 (fp_to_fp16)`. Another approach is to legalize `fp_round` to `(bitcast to f16 (truncate to i16 (fp_to_fp16)`?
I'm confused. Is it i16 to i16 or i16 to f16?


https://reviews.llvm.org/D26767





More information about the llvm-commits mailing list