[llvm-dev] floating point vector instructions

Rail Shafigulin via llvm-dev llvm-dev at lists.llvm.org
Sat Apr 2 14:18:24 PDT 2016


I've added floating point vector instructions to my target. However when I
run a simple test I don't them being generated. What I see is a jump to the
library. Does anyone know why llvm is doing it and how I can force it to
use a my floating point vector instructions?

Any help is appreciated.

Here are the details of what I'm talking about:

Command Line:
clang --target=esencia -S -O3 test.c -o test.s

Instruction definition:

// Floating point instructions
class InstFRR<bits<8> op, dag outs, dag ins, string asmstr, list<dag>
pattern>
  : InstEsencia<outs, ins, asmstr, pattern> {
  let optype = 0b11;
  let opcode = 0b0010;
  let Inst{7-0} = op;
}

class VALU<bits<8> subOp, string asmstr, SDNode OpNode>
  : InstFRR<subOp, (outs VR:$rD), (ins VR:$rA, VR:$rB),
           !strconcat(asmstr, "\t$rD, $rA, $rB"),
           [(set VR:$rD, (OpNode VR:$rA, VR:$rB))]> {
  bits<5> rD;
  bits<5> rA;
  bits<5> rB;

  let Inst{25-21} = rD;
  let Inst{20-16} = rA;
  let Inst{15-11} = rB;
}

let Itinerary = v_fadd in
  def VFADD : VALU<0x1a, "v.fadd", fadd>;

Test file:

#define N 32

void foo (float *a, float *b, float *c) {

  for (int i = 0; i < N; ++i)
       c[i] = a[i] + b[i];
}

Jump instruction that I see:
l.jal __addsf3

It should use:
v.fadd v0, v1, v2


-- 
Rail Shafigulin
Software Engineer
Esencia Technologies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160402/f499ff4d/attachment.html>


More information about the llvm-dev mailing list