[LLVMdev] SSE Scalar Convert Intrinsics

David Greene dag at cray.com
Fri Jun 5 08:51:15 PDT 2009


I have a question about the SSE scalar convert intrinsics.

cvtsd2si is defined thusly:

  def int_x86_sse2_cvtsd2si64 : GCCBuiltin<"__builtin_ia32_cvtsd2si64">,
              Intrinsic<[llvm_i64_ty, llvm_v2f64_ty], [IntrNoMem]>;

This matches the signature of the GCC intrinsic.  The fact that the GCC
intrinsic has a type mismatch on the input (vector rather than scalar)
is strange, but ok, we'll run with it.

Until this:

def Int_CVTSD2SIrm : SDI<0x2D, MRMSrcMem, (outs GR32:$dst), (ins f128mem:
$src),
                         "cvtsd2si\t{$src, $dst|$dst, $src}",
                         [(set GR32:$dst, (int_x86_sse2_cvtsd2si
                                           (load addr:$src)))]>;

Er, this makes us load a 128-bit quantity, which is almost certainly not
what we want.

Do we need two intrinsics for these scalar converts, one to satisfy the
(arguably broken) GCC interface and one to really reflect the operation
as specified by the ISA?

                                   -Dave



More information about the llvm-dev mailing list