1af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt/* 2af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * Copyright © 2011 Intel Corporation 3af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * 4af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * Permission is hereby granted, free of charge, to any person obtaining a 5af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * copy of this software and associated documentation files (the "Software"), 6af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * to deal in the Software without restriction, including without limitation 7af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * and/or sell copies of the Software, and to permit persons to whom the 9af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * Software is furnished to do so, subject to the following conditions: 10af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * 11af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * The above copyright notice and this permission notice (including the next 12af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * paragraph) shall be included in all copies or substantial portions of the 13af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * Software. 14af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * 15af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * IN THE SOFTWARE. 22af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt */ 23af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 24af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#ifndef BRW_VEC4_H 25af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#define BRW_VEC4_H 26af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 27af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#include <stdint.h> 28af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#include "brw_shader.h" 29af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#include "main/compiler.h" 30af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#include "program/hash_table.h" 31af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 32af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtextern "C" { 33af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#include "brw_vs.h" 34af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#include "brw_context.h" 35af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#include "brw_eu.h" 36af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt}; 37af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 382f0edc60f4bd2ae5999a6afa656e3bb3f181bf0fChad Versace#include "glsl/ir.h" 39af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 40af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtnamespace brw { 41af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 42af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtclass dst_reg; 43af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 44b2f5d4c3ec9ec2fec8b39c87eb00121a24107276Eric Anholtunsigned 45b2f5d4c3ec9ec2fec8b39c87eb00121a24107276Eric Anholtswizzle_for_size(int size); 46af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 47af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtenum register_file { 48af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt ARF = BRW_ARCHITECTURE_REGISTER_FILE, 49af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt GRF = BRW_GENERAL_REGISTER_FILE, 50af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt MRF = BRW_MESSAGE_REGISTER_FILE, 51af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt IMM = BRW_IMMEDIATE_VALUE, 52af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt HW_REG, /* a struct brw_reg */ 53af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt ATTR, 54af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt UNIFORM, /* prog_data->params[hw_reg] */ 55af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt BAD_FILE 56af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt}; 57af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 58af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtclass reg 59af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt{ 60af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtpublic: 61af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** Register file: ARF, GRF, MRF, IMM. */ 62af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt enum register_file file; 63af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** virtual register number. 0 = fixed hw reg */ 64af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int reg; 65af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** Offset within the virtual register. */ 66af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int reg_offset; 67af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** Register type. BRW_REGISTER_TYPE_* */ 68af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int type; 69af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg fixed_hw_reg; 70af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 71af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** Value for file == BRW_IMMMEDIATE_FILE */ 72af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt union { 73af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int32_t i; 74af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt uint32_t u; 75af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt float f; 76af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } imm; 77af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt}; 78af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 79af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtclass src_reg : public reg 80af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt{ 81af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtpublic: 82af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /* Callers of this ralloc-based new need not call delete. It's 83af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * easier to just ralloc_free 'ctx' (or any of its ancestors). */ 84af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt static void* operator new(size_t size, void *ctx) 85af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 86af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void *node; 87af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 88af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt node = ralloc_size(ctx, size); 89af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt assert(node != NULL); 90af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 91af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt return node; 92af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 93af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 94b2f5d4c3ec9ec2fec8b39c87eb00121a24107276Eric Anholt void init(); 95af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 96b2f5d4c3ec9ec2fec8b39c87eb00121a24107276Eric Anholt src_reg(register_file file, int reg, const glsl_type *type); 97b2f5d4c3ec9ec2fec8b39c87eb00121a24107276Eric Anholt src_reg(); 98b2f5d4c3ec9ec2fec8b39c87eb00121a24107276Eric Anholt src_reg(float f); 99b2f5d4c3ec9ec2fec8b39c87eb00121a24107276Eric Anholt src_reg(uint32_t u); 100b2f5d4c3ec9ec2fec8b39c87eb00121a24107276Eric Anholt src_reg(int32_t i); 101af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 10242ce13195b94d0d51ca8e7fa5eed07fde8f37988Eric Anholt bool equals(src_reg *r); 103f0c04e6c22babf2aee2ad1ee85dbd6f996be3712Eric Anholt bool is_zero() const; 104f0c04e6c22babf2aee2ad1ee85dbd6f996be3712Eric Anholt bool is_one() const; 10542ce13195b94d0d51ca8e7fa5eed07fde8f37988Eric Anholt 106af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg(class vec4_visitor *v, const struct glsl_type *type); 107af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 108af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt explicit src_reg(dst_reg reg); 109af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 110af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt GLuint swizzle; /**< SWIZZLE_XYZW swizzles from Mesa. */ 111af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool negate; 112af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool abs; 1131ff4f11dd94711a498cde0330101c58636ef2741Eric Anholt 1141ff4f11dd94711a498cde0330101c58636ef2741Eric Anholt src_reg *reladdr; 115af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt}; 116af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 117af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtclass dst_reg : public reg 118af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt{ 119af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtpublic: 120af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /* Callers of this ralloc-based new need not call delete. It's 121af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * easier to just ralloc_free 'ctx' (or any of its ancestors). */ 122af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt static void* operator new(size_t size, void *ctx) 123af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 124af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void *node; 125af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 126af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt node = ralloc_size(ctx, size); 127af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt assert(node != NULL); 128af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 129af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt return node; 130af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 131af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 132b2f5d4c3ec9ec2fec8b39c87eb00121a24107276Eric Anholt void init(); 133af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 134b2f5d4c3ec9ec2fec8b39c87eb00121a24107276Eric Anholt dst_reg(); 135b2f5d4c3ec9ec2fec8b39c87eb00121a24107276Eric Anholt dst_reg(register_file file, int reg); 136b2f5d4c3ec9ec2fec8b39c87eb00121a24107276Eric Anholt dst_reg(register_file file, int reg, const glsl_type *type, int writemask); 137b2f5d4c3ec9ec2fec8b39c87eb00121a24107276Eric Anholt dst_reg(struct brw_reg reg); 138af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg(class vec4_visitor *v, const struct glsl_type *type); 139af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 140af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt explicit dst_reg(src_reg reg); 141af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 142af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int writemask; /**< Bitfield of WRITEMASK_[XYZW] */ 1431ff4f11dd94711a498cde0330101c58636ef2741Eric Anholt 1441ff4f11dd94711a498cde0330101c58636ef2741Eric Anholt src_reg *reladdr; 145af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt}; 146af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 147af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtclass vec4_instruction : public exec_node { 148af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtpublic: 149af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /* Callers of this ralloc-based new need not call delete. It's 150af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * easier to just ralloc_free 'ctx' (or any of its ancestors). */ 151af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt static void* operator new(size_t size, void *ctx) 152af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 153af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void *node; 154af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 155af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt node = rzalloc_size(ctx, size); 156af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt assert(node != NULL); 157af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 158af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt return node; 159af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 160af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 16188e08de8017b69591b37dafde9afd15f796fb404Eric Anholt vec4_instruction(vec4_visitor *v, enum opcode opcode, 16288e08de8017b69591b37dafde9afd15f796fb404Eric Anholt dst_reg dst = dst_reg(), 16388e08de8017b69591b37dafde9afd15f796fb404Eric Anholt src_reg src0 = src_reg(), 16488e08de8017b69591b37dafde9afd15f796fb404Eric Anholt src_reg src1 = src_reg(), 16588e08de8017b69591b37dafde9afd15f796fb404Eric Anholt src_reg src2 = src_reg()); 16688e08de8017b69591b37dafde9afd15f796fb404Eric Anholt 167af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg get_dst(void); 168af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg get_src(int i); 169af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 170af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt enum opcode opcode; /* BRW_OPCODE_* or FS_OPCODE_* */ 171af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg dst; 172af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg src[3]; 173af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 174af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool saturate; 175af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool predicate_inverse; 176af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt uint32_t predicate; 177af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 178af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int conditional_mod; /**< BRW_CONDITIONAL_* */ 179af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 180af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int sampler; 181328b693a199a67ce3a17d258f34d7bfd26790871Kenneth Graunke uint32_t texture_offset; /**< Texture Offset bitfield */ 182af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int target; /**< MRT target. */ 183af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool shadow_compare; 184af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 185af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool eot; 186af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool header_present; 187af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int mlen; /**< SEND message length */ 188af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int base_mrf; /**< First MRF in the SEND message, if mlen is nonzero. */ 189af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 190af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt uint32_t offset; /* spill/unspill offset */ 191af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** @{ 192af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * Annotation for the generated IR. One of the two can be set. 193af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt */ 194af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt ir_instruction *ir; 195af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt const char *annotation; 196cc9eb936c220267b6130b705fc696d05906a31dfEric Anholt 1977e7c40ff98cc2b930bc3113609ace5430f2bdc95Kenneth Graunke bool is_tex(); 198cc9eb936c220267b6130b705fc696d05906a31dfEric Anholt bool is_math(); 199af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt}; 200af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 201af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtclass vec4_visitor : public ir_visitor 202af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt{ 203af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtpublic: 204af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt vec4_visitor(struct brw_vs_compile *c, 205af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct gl_shader_program *prog, struct brw_shader *shader); 206af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt ~vec4_visitor(); 207af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 208af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg dst_null_f() 209af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 210af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt return dst_reg(brw_null_reg()); 211af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 212af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 213af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg dst_null_d() 214af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 215af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt return dst_reg(retype(brw_null_reg(), BRW_REGISTER_TYPE_D)); 216af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 217af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 218af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_context *brw; 219af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt const struct gl_vertex_program *vp; 220af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct intel_context *intel; 221af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct gl_context *ctx; 222af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_vs_compile *c; 223af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_vs_prog_data *prog_data; 224af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_compile *p; 225af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_shader *shader; 226af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct gl_shader_program *prog; 227af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void *mem_ctx; 228af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt exec_list instructions; 229af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 230af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt char *fail_msg; 231af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool failed; 232af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 233af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** 234af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * GLSL IR currently being processed, which is associated with our 235af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * driver IR instructions for debugging purposes. 236af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt */ 237af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt ir_instruction *base_ir; 238af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt const char *current_annotation; 239af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 240af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int *virtual_grf_sizes; 241af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int virtual_grf_count; 242af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int virtual_grf_array_size; 243af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int first_non_payload_grf; 2449195191e50429d9cf25e6498f9fb108758ac2be6Eric Anholt unsigned int max_grf; 2453dadc1e3cceac80a1b63cad2e10f0e0f8904531bEric Anholt int *virtual_grf_def; 2463dadc1e3cceac80a1b63cad2e10f0e0f8904531bEric Anholt int *virtual_grf_use; 247e7da40afe84349a640fe15e3af408a0dfe880e85Paul Berry dst_reg userplane[MAX_CLIP_PLANES]; 24887b51fc4a807616eaab0c4b38e41c328c08875e3Eric Anholt 24987b51fc4a807616eaab0c4b38e41c328c08875e3Eric Anholt /** 25087b51fc4a807616eaab0c4b38e41c328c08875e3Eric Anholt * This is the size to be used for an array with an element per 25187b51fc4a807616eaab0c4b38e41c328c08875e3Eric Anholt * reg_offset 25287b51fc4a807616eaab0c4b38e41c328c08875e3Eric Anholt */ 25387b51fc4a807616eaab0c4b38e41c328c08875e3Eric Anholt int virtual_grf_reg_count; 25487b51fc4a807616eaab0c4b38e41c328c08875e3Eric Anholt /** Per-virtual-grf indices into an array of size virtual_grf_reg_count */ 25587b51fc4a807616eaab0c4b38e41c328c08875e3Eric Anholt int *virtual_grf_reg_map; 25687b51fc4a807616eaab0c4b38e41c328c08875e3Eric Anholt 2573dadc1e3cceac80a1b63cad2e10f0e0f8904531bEric Anholt bool live_intervals_valid; 258af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 259af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg *variable_storage(ir_variable *var); 260af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 261af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void reladdr_to_temp(ir_instruction *ir, src_reg *reg, int *num_reladdr); 262af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 263af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg src_reg_for_float(float val); 264af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 265af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** 266af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * \name Visit methods 267af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * 268af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * As typical for the visitor pattern, there must be one \c visit method for 269af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * each concrete subclass of \c ir_instruction. Virtual base classes within 270af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * the hierarchy should not have \c visit methods. 271af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt */ 272af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /*@{*/ 273af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_variable *); 274af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_loop *); 275af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_loop_jump *); 276af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_function_signature *); 277af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_function *); 278af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_expression *); 279af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_swizzle *); 280af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_dereference_variable *); 281af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_dereference_array *); 282af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_dereference_record *); 283af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_assignment *); 284af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_constant *); 285af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_call *); 286af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_return *); 287af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_discard *); 288af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_texture *); 289af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_if *); 290af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /*@}*/ 291af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 292af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg result; 293af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 294af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /* Regs for vertex results. Generated at ir_variable visiting time 295af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * for the ir->location's used. 296af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt */ 29734fbab2125555ba0afffa361e1c74fb3359ef3a7Paul Berry dst_reg output_reg[BRW_VERT_RESULT_MAX]; 2986af968b6736c87c05ea579df50e23b6f23b900d4Eric Anholt const char *output_reg_annotation[BRW_VERT_RESULT_MAX]; 299a070d5f363e99b0f846d555e9ca3a74ec807fdc0Eric Anholt int uniform_size[MAX_UNIFORMS]; 300483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt int uniform_vector_size[MAX_UNIFORMS]; 301a070d5f363e99b0f846d555e9ca3a74ec807fdc0Eric Anholt int uniforms; 302af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 303af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct hash_table *variable_ht; 304af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 305af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool run(void); 306af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void fail(const char *msg, ...); 307af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 308af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int virtual_grf_alloc(int size); 309e7da40afe84349a640fe15e3af408a0dfe880e85Paul Berry void setup_uniform_clipplane_values(); 310a070d5f363e99b0f846d555e9ca3a74ec807fdc0Eric Anholt int setup_uniform_values(int loc, const glsl_type *type); 311a070d5f363e99b0f846d555e9ca3a74ec807fdc0Eric Anholt void setup_builtin_uniform_values(ir_variable *ir); 312af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int setup_attributes(int payload_reg); 313a070d5f363e99b0f846d555e9ca3a74ec807fdc0Eric Anholt int setup_uniforms(int payload_reg); 314af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void setup_payload(); 3154e35ffa762d763820b7defc14af564b2a02c61c8Eric Anholt bool reg_allocate_trivial(); 3164e35ffa762d763820b7defc14af564b2a02c61c8Eric Anholt bool reg_allocate(); 317b22de71c1bc2530e139d75d934e203f4eee89f41Kenneth Graunke void evaluate_spill_costs(float *spill_costs, bool *no_spill); 318b22de71c1bc2530e139d75d934e203f4eee89f41Kenneth Graunke int choose_spill_reg(struct ra_graph *g); 319b22de71c1bc2530e139d75d934e203f4eee89f41Kenneth Graunke void spill_reg(int spill_reg); 320d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt void move_grf_array_access_to_scratch(); 321483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt void move_uniform_array_access_to_pull_constants(); 322df35d691807656d3627b6fa6f51a08674bdc043eEric Anholt void move_push_constants_to_pull_constants(); 3237c84b9d303345fa5075dba8c4ea7af449d93b0f8Eric Anholt void split_uniform_registers(); 32472cfc6f3778d8297e52c254a5861a88eb62e4d67Eric Anholt void pack_uniform_registers(); 3253dadc1e3cceac80a1b63cad2e10f0e0f8904531bEric Anholt void calculate_live_intervals(); 3268174945d3346dc049ae56dcb4bf1eab39f5c88aaEric Anholt bool dead_code_eliminate(); 3273dadc1e3cceac80a1b63cad2e10f0e0f8904531bEric Anholt bool virtual_grf_interferes(int a, int b); 32842ce13195b94d0d51ca8e7fa5eed07fde8f37988Eric Anholt bool opt_copy_propagation(); 329f0c04e6c22babf2aee2ad1ee85dbd6f996be3712Eric Anholt bool opt_algebraic(); 330c662764f4f9d9d0303fb2685dfdc93824fa15dcaEric Anholt bool opt_compute_to_mrf(); 331af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 33288e08de8017b69591b37dafde9afd15f796fb404Eric Anholt vec4_instruction *emit(vec4_instruction *inst); 33388e08de8017b69591b37dafde9afd15f796fb404Eric Anholt 334af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt vec4_instruction *emit(enum opcode opcode); 335af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 336af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt vec4_instruction *emit(enum opcode opcode, dst_reg dst, src_reg src0); 337af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 338af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt vec4_instruction *emit(enum opcode opcode, dst_reg dst, 339af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg src0, src_reg src1); 340af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 341af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt vec4_instruction *emit(enum opcode opcode, dst_reg dst, 342af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg src0, src_reg src1, src_reg src2); 343af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 3440c9ae24dbdfcfea06fb0e8cdfd7737da48fa4e31Eric Anholt vec4_instruction *emit_before(vec4_instruction *inst, 3450c9ae24dbdfcfea06fb0e8cdfd7737da48fa4e31Eric Anholt vec4_instruction *new_inst); 3460c9ae24dbdfcfea06fb0e8cdfd7737da48fa4e31Eric Anholt 3472f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *MOV(dst_reg dst, src_reg src0); 3482f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *NOT(dst_reg dst, src_reg src0); 3492f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *RNDD(dst_reg dst, src_reg src0); 3502f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *RNDE(dst_reg dst, src_reg src0); 3512f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *RNDZ(dst_reg dst, src_reg src0); 3522f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *FRC(dst_reg dst, src_reg src0); 3532f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *ADD(dst_reg dst, src_reg src0, src_reg src1); 3542f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *MUL(dst_reg dst, src_reg src0, src_reg src1); 3552f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *MACH(dst_reg dst, src_reg src0, src_reg src1); 3562f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *MAC(dst_reg dst, src_reg src0, src_reg src1); 3572f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *AND(dst_reg dst, src_reg src0, src_reg src1); 3582f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *OR(dst_reg dst, src_reg src0, src_reg src1); 3592f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *XOR(dst_reg dst, src_reg src0, src_reg src1); 3602f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *DP3(dst_reg dst, src_reg src0, src_reg src1); 3612f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *DP4(dst_reg dst, src_reg src0, src_reg src1); 3622f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *CMP(dst_reg dst, src_reg src0, src_reg src1, 3632f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt uint32_t condition); 3642f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *IF(src_reg src0, src_reg src1, uint32_t condition); 3652f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt vec4_instruction *IF(uint32_t predicate); 3660c9ae24dbdfcfea06fb0e8cdfd7737da48fa4e31Eric Anholt vec4_instruction *PULL_CONSTANT_LOAD(dst_reg dst, src_reg index); 3670c9ae24dbdfcfea06fb0e8cdfd7737da48fa4e31Eric Anholt vec4_instruction *SCRATCH_READ(dst_reg dst, src_reg index); 3680c9ae24dbdfcfea06fb0e8cdfd7737da48fa4e31Eric Anholt vec4_instruction *SCRATCH_WRITE(dst_reg dst, src_reg src, src_reg index); 3692f12be5c952ec84eece74a321e5b0a92314aba3aEric Anholt 370160848d8ef96cf3a760c02cc576df7dbffc1f669Eric Anholt int implied_mrf_writes(vec4_instruction *inst); 371160848d8ef96cf3a760c02cc576df7dbffc1f669Eric Anholt 3727642c1de6b65b7dfd9e39904291cc9737cd54b56Eric Anholt bool try_rewrite_rhs_to_dst(ir_assignment *ir, 3737642c1de6b65b7dfd9e39904291cc9737cd54b56Eric Anholt dst_reg dst, 3747642c1de6b65b7dfd9e39904291cc9737cd54b56Eric Anholt src_reg src, 3757642c1de6b65b7dfd9e39904291cc9737cd54b56Eric Anholt vec4_instruction *pre_rhs_inst, 3767642c1de6b65b7dfd9e39904291cc9737cd54b56Eric Anholt vec4_instruction *last_rhs_inst); 3777642c1de6b65b7dfd9e39904291cc9737cd54b56Eric Anholt 378af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** Walks an exec_list of ir_instruction and sends it through this visitor. */ 379af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void visit_instructions(const exec_list *list); 380af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 381bba910373fc6cdca939422d94adfe58b43e41b86Eric Anholt void emit_bool_to_cond_code(ir_rvalue *ir, uint32_t *predicate); 382af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_bool_comparison(unsigned int op, dst_reg dst, src_reg src0, src_reg src1); 383af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_if_gen6(ir_if *ir); 384af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 385979072613139870f12e329e4b483c7f688b40560Eric Anholt void emit_block_move(dst_reg *dst, src_reg *src, 386bba910373fc6cdca939422d94adfe58b43e41b86Eric Anholt const struct glsl_type *type, uint32_t predicate); 387af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 38831ef2e3ec2f5837eea0899b4bda5ea15e335a6a2Eric Anholt void emit_constant_values(dst_reg *dst, ir_constant *value); 38931ef2e3ec2f5837eea0899b4bda5ea15e335a6a2Eric Anholt 390af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** 391af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * Emit the correct dot-product instruction for the type of arguments 392af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt */ 393af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_dp(dst_reg dst, src_reg src0, src_reg src1, unsigned elements); 394af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 395af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_scalar(ir_instruction *ir, enum prog_opcode op, 396af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg dst, src_reg src0); 397af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 398af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_scalar(ir_instruction *ir, enum prog_opcode op, 399af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg dst, src_reg src0, src_reg src1); 400af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 401af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_scs(ir_instruction *ir, enum prog_opcode op, 402af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg dst, const src_reg &src); 403af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 404af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_math1_gen6(enum opcode opcode, dst_reg dst, src_reg src); 405af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_math1_gen4(enum opcode opcode, dst_reg dst, src_reg src); 406af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_math(enum opcode opcode, dst_reg dst, src_reg src); 407af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_math2_gen6(enum opcode opcode, dst_reg dst, src_reg src0, src_reg src1); 408af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_math2_gen4(enum opcode opcode, dst_reg dst, src_reg src0, src_reg src1); 409af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_math(enum opcode opcode, dst_reg dst, src_reg src0, src_reg src1); 410af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 4118e34021099527868097b2c877fc32f29aa4d7bb6Kenneth Graunke void swizzle_result(ir_texture *ir, src_reg orig_val, int sampler); 4128e34021099527868097b2c877fc32f29aa4d7bb6Kenneth Graunke 413f86d1976f81811aec0a555946e263295ed1403dbPaul Berry void emit_ndc_computation(); 414d9eca0b27903acef97f7b69a70dc791b433f1c98Paul Berry void emit_psiz_and_flags(struct brw_reg reg); 415d1435a49e9765ab4e988dd8b65a5599da34f3512Paul Berry void emit_clip_distances(struct brw_reg reg, int offset); 41662bad54727690bff5ed42a74272e7822fd36cdb6Paul Berry void emit_generic_urb_slot(dst_reg reg, int vert_result); 417e604f98f580b74dd6c597ef492706ce74697443ePaul Berry void emit_urb_slot(int mrf, int vert_result); 418af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_urb_writes(void); 419af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 420d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt src_reg get_scratch_offset(vec4_instruction *inst, 421d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt src_reg *reladdr, int reg_offset); 422483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt src_reg get_pull_constant_offset(vec4_instruction *inst, 423483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt src_reg *reladdr, int reg_offset); 424d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt void emit_scratch_read(vec4_instruction *inst, 425d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt dst_reg dst, 426d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt src_reg orig_src, 427d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt int base_offset); 428d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt void emit_scratch_write(vec4_instruction *inst, 429d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt src_reg temp, 430d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt dst_reg orig_dst, 431d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt int base_offset); 432483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt void emit_pull_constant_load(vec4_instruction *inst, 433483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt dst_reg dst, 434483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt src_reg orig_src, 435483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt int base_offset); 436d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt 4372e5a1a254ed81b1d3efa6064f48183eefac784d0Kenneth Graunke bool try_emit_sat(ir_expression *ir); 43831874f074c2eaf2a9421c57f0798c79078d296c4Eric Anholt void resolve_ud_negate(src_reg *reg); 439af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 440af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool process_move_condition(ir_rvalue *ir); 441af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 442af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void generate_code(); 443af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void generate_vs_instruction(vec4_instruction *inst, 444af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg dst, 445af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg *src); 446abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt 447af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void generate_math1_gen4(vec4_instruction *inst, 448af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg dst, 449af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg src); 450af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void generate_math1_gen6(vec4_instruction *inst, 451af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg dst, 452af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg src); 453abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt void generate_math2_gen4(vec4_instruction *inst, 454abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt struct brw_reg dst, 455abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt struct brw_reg src0, 456abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt struct brw_reg src1); 457abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt void generate_math2_gen6(vec4_instruction *inst, 458abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt struct brw_reg dst, 459abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt struct brw_reg src0, 460abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt struct brw_reg src1); 461a73c65c5342bf41fa0dfefe7daa9197ce6a11db4Kenneth Graunke void generate_math2_gen7(vec4_instruction *inst, 462a73c65c5342bf41fa0dfefe7daa9197ce6a11db4Kenneth Graunke struct brw_reg dst, 463a73c65c5342bf41fa0dfefe7daa9197ce6a11db4Kenneth Graunke struct brw_reg src0, 464a73c65c5342bf41fa0dfefe7daa9197ce6a11db4Kenneth Graunke struct brw_reg src1); 465abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt 466ca182cd0fa338ad39d531cb1be6a5a1bbf455771Kenneth Graunke void generate_tex(vec4_instruction *inst, 467ca182cd0fa338ad39d531cb1be6a5a1bbf455771Kenneth Graunke struct brw_reg dst, 468ca182cd0fa338ad39d531cb1be6a5a1bbf455771Kenneth Graunke struct brw_reg src); 469ca182cd0fa338ad39d531cb1be6a5a1bbf455771Kenneth Graunke 470af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void generate_urb_write(vec4_instruction *inst); 471584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt void generate_oword_dual_block_offsets(struct brw_reg m1, 472584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt struct brw_reg index); 473584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt void generate_scratch_write(vec4_instruction *inst, 474584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt struct brw_reg dst, 475584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt struct brw_reg src, 476584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt struct brw_reg index); 477584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt void generate_scratch_read(vec4_instruction *inst, 478584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt struct brw_reg dst, 479584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt struct brw_reg index); 480483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt void generate_pull_constant_load(vec4_instruction *inst, 481483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt struct brw_reg dst, 482bb020d09c382285210a5aebe412ddabfad19e4a0Eric Anholt struct brw_reg index, 483bb020d09c382285210a5aebe412ddabfad19e4a0Eric Anholt struct brw_reg offset); 484af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt}; 485af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 486af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt} /* namespace brw */ 487af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 488af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#endif /* BRW_VEC4_H */ 489