nvc0/ir: Add support for double immediates
authorHans de Goede <hdegoede@redhat.com>
Thu, 5 Nov 2015 13:32:34 +0000 (14:32 +0100)
committerIlia Mirkin <imirkin@alum.mit.edu>
Fri, 6 Nov 2015 22:22:40 +0000 (17:22 -0500)
Add support for encoding double immediates (up to 20 bits of precision)
into the generated nvc0 machine-code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp

index fd103146c720a6bedcb2a6d00effd9c46077d4c4..8784f3b0a21bf899ff31f326c186935694d52e68 100644 (file)
@@ -323,6 +323,14 @@ CodeEmitterNVC0::setImmediate(const Instruction *i, const int s)
    assert(imm);
    u32 = imm->reg.data.u32;
 
+   if ((code[0] & 0xf) == 0x1) {
+      // double immediate
+      uint64_t u64 = imm->reg.data.u64;
+      assert(!(u64 & 0x00000fffffffffffULL));
+      assert(!(code[1] & 0xc000));
+      code[0] |= ((u64 >> 44) & 0x3f) << 26;
+      code[1] |= 0xc000 | (u64 >> 50);
+   } else
    if ((code[0] & 0xf) == 0x2) {
       // LIMM
       code[0] |= (u32 & 0x3f) << 26;