| 1 | /* |
| 2 | Copyright (C) Intel Corp. 2006. All Rights Reserved. |
| 3 | Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to |
| 4 | develop this 3D driver. |
| 5 | |
| 6 | Permission is hereby granted, free of charge, to any person obtaining |
| 7 | a copy of this software and associated documentation files (the |
| 8 | "Software"), to deal in the Software without restriction, including |
| 9 | without limitation the rights to use, copy, modify, merge, publish, |
| 10 | distribute, sublicense, and/or sell copies of the Software, and to |
| 11 | permit persons to whom the Software is furnished to do so, subject to |
| 12 | the following conditions: |
| 13 | |
| 14 | The above copyright notice and this permission notice (including the |
| 15 | next paragraph) shall be included in all copies or substantial |
| 16 | portions of the Software. |
| 17 | |
| 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 21 | IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE |
| 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 25 | |
| 26 | **********************************************************************/ |
| 27 | /* |
| 28 | * Authors: |
| 29 | * Keith Whitwell <[email protected]> |
| 30 | */ |
| 31 | |
| 32 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:410:9`! |
| 33 | #include "config.h"cxx . . $ `<file>/config.h`/ |
| 34 | #endif |
| 35 | |
| 36 | #include "brw_eu.h"cxx . . $ `<file>/src/sna/brw/brw_eu.h`/ |
| 37 | |
| 38 | #include <string.h> |
| 39 | #include <stdlib.h> |
| 40 | |
| 41 | /* Returns the corresponding conditional mod for swapping src0 and |
| 42 | * src1 in e.g. CMP. |
| 43 | */ |
| 44 | uint32_tcxx . . $ uint32_t# |
| 45 | brw_swap_cmodcxx . . $ brw_swap_cmod(2141b656ce2cc063).(uint32_tcxx . . $ uint32_t# cmod) |
| 46 | { |
| 47 | switch (cmod) { |
| 48 | case BRW_CONDITIONAL_Zcxx . . $ `src/sna/brw/brw_eu.h:93:9`!: |
| 49 | case BRW_CONDITIONAL_NZcxx . . $ `src/sna/brw/brw_eu.h:94:9`!: |
| 50 | return cmod; |
| 51 | case BRW_CONDITIONAL_Gcxx . . $ `src/sna/brw/brw_eu.h:97:9`!: |
| 52 | return BRW_CONDITIONAL_LEcxx . . $ `src/sna/brw/brw_eu.h:100:9`!; |
| 53 | case BRW_CONDITIONAL_GEcxx . . $ `src/sna/brw/brw_eu.h:98:9`!: |
| 54 | return BRW_CONDITIONAL_Lcxx . . $ `src/sna/brw/brw_eu.h:99:9`!; |
| 55 | case BRW_CONDITIONAL_Lcxx . . $ `src/sna/brw/brw_eu.h:99:9`!: |
| 56 | return BRW_CONDITIONAL_GEcxx . . $ `src/sna/brw/brw_eu.h:98:9`!; |
| 57 | case BRW_CONDITIONAL_LEcxx . . $ `src/sna/brw/brw_eu.h:100:9`!: |
| 58 | return BRW_CONDITIONAL_Gcxx . . $ `src/sna/brw/brw_eu.h:97:9`!; |
| 59 | default: |
| 60 | return ~0; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | /* How does predicate control work when execution_size != 8? Do I |
| 65 | * need to test/set for 0xffff when execution_size is 16? |
| 66 | */ |
| 67 | void brw_set_predicate_control_flag_valuecxx . . $ brw_set_predicate_control_flag_value(56a5bd0f4bb3e6a1).( struct brw_compilecxx . . $ brw_compile# *p, unsigned value ) |
| 68 | { |
| 69 | p->currentcxx . . $ brw_compile#current.->headercxx . . $ brw_instruction#header..predicate_controlcxx . . $ brw_instruction#$anonymous_type_0#predicate_control. = BRW_PREDICATE_NONEcxx . . $ `src/sna/brw/brw_eu.h:242:9`!; |
| 70 | |
| 71 | if (value != 0xff) { |
| 72 | if (value != p->flag_valuecxx . . $ brw_compile#flag_value.) { |
| 73 | brw_MOVcxx . . $ brw_MOV(566f50e9ecbfeed1).(p, brw_flag_regcxx . . $ brw_flag_reg(2e9b8cf5fa51cc57).(), brw_imm_uwcxx . . $ brw_imm_uw(432e5397bf44e627).(value)); |
| 74 | p->flag_valuecxx . . $ brw_compile#flag_value. = value; |
| 75 | } |
| 76 | |
| 77 | p->currentcxx . . $ brw_compile#current.->headercxx . . $ brw_instruction#header..predicate_controlcxx . . $ brw_instruction#$anonymous_type_0#predicate_control. = BRW_PREDICATE_NORMALcxx . . $ `src/sna/brw/brw_eu.h:243:9`!; |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | void brw_set_compression_controlcxx . . $ brw_set_compression_control(34e2efe722be6ec8).(struct brw_compilecxx . . $ brw_compile# *p, |
| 82 | enum brw_compressioncxx . . $ brw_compression# compression_control) |
| 83 | { |
| 84 | p->compressedcxx . . $ brw_compile#compressed. = (compression_control == BRW_COMPRESSION_COMPRESSEDcxx . . $ BRW_COMPRESSION_COMPRESSED.); |
| 85 | |
| 86 | if (p->gencxx . . $ brw_compile#gen. >= 060) { |
| 87 | /* Since we don't use the 32-wide support in gen6, we translate |
| 88 | * the pre-gen6 compression control here. |
| 89 | */ |
| 90 | switch (compression_control) { |
| 91 | case BRW_COMPRESSION_NONEcxx . . $ BRW_COMPRESSION_NONE.: |
| 92 | /* This is the "use the first set of bits of dmask/vmask/arf |
| 93 | * according to execsize" option. |
| 94 | */ |
| 95 | p->currentcxx . . $ brw_compile#current.->headercxx . . $ brw_instruction#header..compression_controlcxx . . $ brw_instruction#$anonymous_type_0#compression_control. = GEN6_COMPRESSION_1Qcxx . . $ `src/sna/brw/brw_eu.h:85:9`!; |
| 96 | break; |
| 97 | case BRW_COMPRESSION_2NDHALFcxx . . $ BRW_COMPRESSION_2NDHALF.: |
| 98 | /* For 8-wide, this is "use the second set of 8 bits." */ |
| 99 | p->currentcxx . . $ brw_compile#current.->headercxx . . $ brw_instruction#header..compression_controlcxx . . $ brw_instruction#$anonymous_type_0#compression_control. = GEN6_COMPRESSION_2Qcxx . . $ `src/sna/brw/brw_eu.h:86:9`!; |
| 100 | break; |
| 101 | case BRW_COMPRESSION_COMPRESSEDcxx . . $ BRW_COMPRESSION_COMPRESSED.: |
| 102 | /* For 16-wide instruction compression, use the first set of 16 bits |
| 103 | * since we don't do 32-wide dispatch. |
| 104 | */ |
| 105 | p->currentcxx . . $ brw_compile#current.->headercxx . . $ brw_instruction#header..compression_controlcxx . . $ brw_instruction#$anonymous_type_0#compression_control. = GEN6_COMPRESSION_1Hcxx . . $ `src/sna/brw/brw_eu.h:89:9`!; |
| 106 | break; |
| 107 | default: |
| 108 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(!"not reached"); |
| 109 | p->currentcxx . . $ brw_compile#current.->headercxx . . $ brw_instruction#header..compression_controlcxx . . $ brw_instruction#$anonymous_type_0#compression_control. = GEN6_COMPRESSION_1Hcxx . . $ `src/sna/brw/brw_eu.h:89:9`!; |
| 110 | break; |
| 111 | } |
| 112 | } else { |
| 113 | p->currentcxx . . $ brw_compile#current.->headercxx . . $ brw_instruction#header..compression_controlcxx . . $ brw_instruction#$anonymous_type_0#compression_control. = compression_control; |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | void brw_push_insn_statecxx . . $ brw_push_insn_state(b5ee3eb08d658395).( struct brw_compilecxx . . $ brw_compile# *p ) |
| 118 | { |
| 119 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(p->current != &p->stack[BRW_EU_MAX_INSN_STACK-1]); |
| 120 | memcpycxx . . $ memcpy(cc817cb175f282d).(p->currentcxx . . $ brw_compile#current.+1, p->currentcxx . . $ brw_compile#current., sizeof(struct brw_instructioncxx . . $ brw_instruction#)); |
| 121 | p->compressed_stackcxx . . $ brw_compile#compressed_stack.[p->currentcxx . . $ brw_compile#current. - p->stackcxx . . $ brw_compile#stack.] = p->compressedcxx . . $ brw_compile#compressed.; |
| 122 | p->currentcxx . . $ brw_compile#current.++; |
| 123 | } |
| 124 | |
| 125 | void brw_pop_insn_statecxx . . $ brw_pop_insn_state(b5ee3eb08d658395).( struct brw_compilecxx . . $ brw_compile# *p ) |
| 126 | { |
| 127 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(p->current != p->stack); |
| 128 | p->currentcxx . . $ brw_compile#current.--; |
| 129 | p->compressedcxx . . $ brw_compile#compressed. = p->compressed_stackcxx . . $ brw_compile#compressed_stack.[p->currentcxx . . $ brw_compile#current. - p->stackcxx . . $ brw_compile#stack.]; |
| 130 | } |
| 131 | |
| 132 | void brw_compile_initcxx . . $ brw_compile_init(feb44f4c5d174a68).(struct brw_compilecxx . . $ brw_compile# *p, int gen, void *store) |
| 133 | { |
| 134 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(gen); |
| 135 | |
| 136 | p->gencxx . . $ brw_compile#gen. = gen; |
| 137 | p->storecxx . . $ brw_compile#store. = store; |
| 138 | |
| 139 | p->nr_insncxx . . $ brw_compile#nr_insn. = 0; |
| 140 | p->currentcxx . . $ brw_compile#current. = p->stackcxx . . $ brw_compile#stack.; |
| 141 | p->compressedcxx . . $ brw_compile#compressed. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 142 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(p->currentcxx . . $ brw_compile#current., 0, sizeof(p->currentcxx . . $ brw_compile#current.[0])); |
| 143 | |
| 144 | /* Some defaults? |
| 145 | */ |
| 146 | brw_set_mask_controlcxx . . $ brw_set_mask_control(56a5bd0f4bb3e6a1).(p, BRW_MASK_ENABLEcxx . . $ `src/sna/brw/brw_eu.h:128:9`!); /* what does this do? */ |
| 147 | brw_set_saturatecxx . . $ brw_set_saturate(56a5bd0f4bb3e6a1).(p, 0); |
| 148 | brw_set_compression_controlcxx . . $ brw_set_compression_control(34e2efe722be6ec8).(p, BRW_COMPRESSION_NONEcxx . . $ BRW_COMPRESSION_NONE.); |
| 149 | brw_set_predicate_control_flag_valuecxx . . $ brw_set_predicate_control_flag_value(56a5bd0f4bb3e6a1).(p, 0xff); |
| 150 | |
| 151 | p->if_stack_depthcxx . . $ brw_compile#if_stack_depth. = 0; |
| 152 | p->if_stack_array_sizecxx . . $ brw_compile#if_stack_array_size. = 0; |
| 153 | p->if_stackcxx . . $ brw_compile#if_stack. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 154 | } |