<commit_before>#ifndef FRAGMENT_ASM_H
#define FRAGMENT_ASM_H

#include <stdint.h>

#define FRAGMENT_ROW_REG_0			0
#define FRAGMENT_ROW_REG_15			15
#define FRAGMENT_ROW_REG(r)			(FRAGMENT_ROW_REG_0 + (r))
#define FRAGMENT_GENERAL_PURPOSE_REG_0		16
#define FRAGMENT_GENERAL_PURPOSE_REG_7		23
#define FRAGMENT_GENERAL_PURPOSE_REG(r)		(FRAGMENT_GENERAL_PURPOSE_REG_0 + (r))
#define FRAGMENT_ALU_RESULT_REG_0		24
#define FRAGMENT_ALU_RESULT_REG_3		27
#define FRAGMENT_ALU_RESULT_REG(r)		(FRAGMENT_ALU_RESULT_REG_0 + (r))
#define FRAGMENT_EMBEDDED_CONSTANT_0		28
#define FRAGMENT_EMBEDDED_CONSTANT_2		30
#define FRAGMENT_EMBEDDED_CONSTANT(r)		(FRAGMENT_EMBEDDED_CONSTANT_0 + (r))
#define FRAGMENT_LOWP_VEC2_0_1			31
#define FRAGMENT_UNIFORM_REG_0			32
#define FRAGMENT_UNIFORM_REG_31			63
#define FRAGMENT_UNIFORM_REG(r)			(FRAGMENT_UNIFORM_REG_0 + (r))
#define FRAGMENT_CONDITION_REG_0		64
#define FRAGMENT_CONDITION_REG_7		71
#define FRAGMENT_CONDITION_REG(r)		(FRAGMENT_CONDITION_REG_0 + (r))
#define FRAGMENT_POS_X				72
#define FRAGMENT_POS_Y				73
#define FRAGMENT_POLYGON_FACE			75

typedef union fragment_instruction_schedule {
	struct __attribute__((packed)) {
		unsigned instructions_nb:2;
		unsigned address:6;
	};

	uint32_t data;
} instr_sched;

#define MFU_NOP		0
#define MFU_RCP		1
#define MFU_RSQ		2
#define MFU_LG2		3
#define MFU_EX2		4
#define MFU_SQRT	5
#define MFU_SIN		6
#define MFU_COS		7
#define MFU_FRC		8
#define MFU_PREEX2	9
#define MFU_PRESIN	10
#define MFU_PRECOS	11

#define MFU_VAR_NOP	0
#define MFU_VAR_FP20	1
#define MFU_VAR_FX10	2

typedef union fragment_mfu_instruction {
	struct __attribute__((packed)) {
		unsigned var0_saturate:1;
		unsigned var0_opcode:2;
		unsigned var0_source:4;

		unsigned var1_saturate:1;
		unsigned var1_opcode:2;
		unsigned var1_source:4;

		unsigned var2_saturate:1;
		unsigned var2_opcode:2;
		unsigned var2_source:4;

		unsigned var3_saturate:1;
		unsigned var3_opcode:2;
		unsigned var3_source:4;

		uint64_t unk_varying:36;
	};

	struct __attribute__((packed)) {
		uint32_t __pad1;
		unsigned __pad2:22;

		unsigned opcode:4;
		unsigned reg:6;
	};

	struct __attribute__((packed)) {
		uint32_t part0;
		uint32_t part1;
	};
} mfu_instr;

#define ALU_CC_NOP			0
#define ALU_CC_ZERO			1
#define ALU_CC_GREATER_THAN_ZERO	2
#define ALU_CC_ZERO_OR_GREATER		3

#define ALU_OPCODE_MAD			0
#define ALU_OPCODE_MIN			1
#define ALU_OPCODE_MAX			2
#define ALU_OPCODE_CSEL			3

#define ALU_NO_SCALE			0
#define ALU_SCALE_X2			1
#define ALU_SCALE_X4			2
#define ALU_SCALE_DIV2			3

union fragment_alu_instruction {
	struct __attribute__((packed)) {
		unsigned rD_fixed10:1;
		unsigned rD_absolute_value:1;
		unsigned rD_enable:1;
		unsigned rD_minus_one:1;
		unsigned rD_sub_reg_select_high:1;
		unsigned rD_reg_select:1;

		unsigned rC_scale_by_two:1;
		unsigned rC_negate:1;
		unsigned rC_absolute_value:1;
		unsigned rC_fixed10:1;
		unsigned rC_minus_one:1;
		unsigned rC_sub_reg_select_high:1;
		unsigned rC_reg_select:7;

		unsigned rB_scale_by_two:1;
		unsigned rB_negate:1;
		unsigned rB_absolute_value:1;
		unsigned rB_fixed10:1;
		unsigned rB_minus_one:1;
		unsigned rB_sub_reg_select_high:1;
		unsigned rB_reg_select:7;

		unsigned rA_scale_by_two:1;
		unsigned rA_negate:1;
		unsigned rA_absolute_value:1;
		unsigned rA_fixed10:1;
		unsigned rA_minus_one:1;
		unsigned rA_sub_reg_select_high:1;
		unsigned rA_reg_select:7;

		unsigned write_low_sub_reg:1;
		unsigned write_high_sub_reg:1;
		unsigned dst_reg:5;
		unsigned write_uniform:1;
		unsigned write_condition_reg:1;
		unsigned condition_code:2;
		unsigned saturate_result:1;
		unsigned scale_result:2;

		unsigned addition_disable:1;
		unsigned accumulate_result_this:1;
		unsigned accumulate_result_other:1;
		unsigned opcode:2;
	};

	struct __attribute__((packed)) {
		uint32_t part0;
		uint32_t part1;
	};
};

typedef union fragment_alu_instruction_x4 {
	struct __attribute__((packed)) {
		union fragment_alu_instruction a[4];<commit_msg>grate: fragment asm: fix ALU destination register bitfield<commit_after>#ifndef FRAGMENT_ASM_H
#define FRAGMENT_ASM_H

#include <stdint.h>

#define FRAGMENT_ROW_REG_0			0
#define FRAGMENT_ROW_REG_15			15
#define FRAGMENT_ROW_REG(r)			(FRAGMENT_ROW_REG_0 + (r))
#define FRAGMENT_GENERAL_PURPOSE_REG_0		16
#define FRAGMENT_GENERAL_PURPOSE_REG_7		23
#define FRAGMENT_GENERAL_PURPOSE_REG(r)		(FRAGMENT_GENERAL_PURPOSE_REG_0 + (r))
#define FRAGMENT_ALU_RESULT_REG_0		24
#define FRAGMENT_ALU_RESULT_REG_3		27
#define FRAGMENT_ALU_RESULT_REG(r)		(FRAGMENT_ALU_RESULT_REG_0 + (r))
#define FRAGMENT_EMBEDDED_CONSTANT_0		28
#define FRAGMENT_EMBEDDED_CONSTANT_2		30
#define FRAGMENT_EMBEDDED_CONSTANT(r)		(FRAGMENT_EMBEDDED_CONSTANT_0 + (r))
#define FRAGMENT_LOWP_VEC2_0_1			31
#define FRAGMENT_UNIFORM_REG_0			32
#define FRAGMENT_UNIFORM_REG_31			63
#define FRAGMENT_UNIFORM_REG(r)			(FRAGMENT_UNIFORM_REG_0 + (r))
#define FRAGMENT_CONDITION_REG_0		64
#define FRAGMENT_CONDITION_REG_7		71
#define FRAGMENT_CONDITION_REG(r)		(FRAGMENT_CONDITION_REG_0 + (r))
#define FRAGMENT_POS_X				72
#define FRAGMENT_POS_Y				73
#define FRAGMENT_POLYGON_FACE			75

typedef union fragment_instruction_schedule {
	struct __attribute__((packed)) {
		unsigned instructions_nb:2;
		unsigned address:6;
	};

	uint32_t data;
} instr_sched;

#define MFU_NOP		0
#define MFU_RCP		1
#define MFU_RSQ		2
#define MFU_LG2		3
#define MFU_EX2		4
#define MFU_SQRT	5
#define MFU_SIN		6
#define MFU_COS		7
#define MFU_FRC		8
#define MFU_PREEX2	9
#define MFU_PRESIN	10
#define MFU_PRECOS	11

#define MFU_VAR_NOP	0
#define MFU_VAR_FP20	1
#define MFU_VAR_FX10	2

typedef union fragment_mfu_instruction {
	struct __attribute__((packed)) {
		unsigned var0_saturate:1;
		unsigned var0_opcode:2;
		unsigned var0_source:4;

		unsigned var1_saturate:1;
		unsigned var1_opcode:2;
		unsigned var1_source:4;

		unsigned var2_saturate:1;
		unsigned var2_opcode:2;
		unsigned var2_source:4;

		unsigned var3_saturate:1;
		unsigned var3_opcode:2;
		unsigned var3_source:4;

		uint64_t unk_varying:36;
	};

	struct __attribute__((packed)) {
		uint32_t __pad1;
		unsigned __pad2:22;

		unsigned opcode:4;
		unsigned reg:6;
	};

	struct __attribute__((packed)) {
		uint32_t part0;
		uint32_t part1;
	};
} mfu_instr;

#define ALU_CC_NOP			0
#define ALU_CC_ZERO			1
#define ALU_CC_GREATER_THAN_ZERO	2
#define ALU_CC_ZERO_OR_GREATER		3

#define ALU_OPCODE_MAD			0
#define ALU_OPCODE_MIN			1
#define ALU_OPCODE_MAX			2
#define ALU_OPCODE_CSEL			3

#define ALU_NO_SCALE			0
#define ALU_SCALE_X2			1
#define ALU_SCALE_X4			2
#define ALU_SCALE_DIV2			3

union fragment_alu_instruction {
	struct __attribute__((packed)) {
		unsigned rD_fixed10:1;
		unsigned rD_absolute_value:1;
		unsigned rD_enable:1;
		unsigned rD_minus_one:1;
		unsigned rD_sub_reg_select_high:1;
		unsigned rD_reg_select:1;

		unsigned rC_scale_by_two:1;
		unsigned rC_negate:1;
		unsigned rC_absolute_value:1;
		unsigned rC_fixed10:1;
		unsigned rC_minus_one:1;
		unsigned rC_sub_reg_select_high:1;
		unsigned rC_reg_select:7;

		unsigned rB_scale_by_two:1;
		unsigned rB_negate:1;
		unsigned rB_absolute_value:1;
		unsigned rB_fixed10:1;
		unsigned rB_minus_one:1;
		unsigned rB_sub_reg_select_high:1;
		unsigned rB_reg_select:7;

		unsigned rA_scale_by_two:1;
		unsigned rA_negate:1;
		unsigned rA_absolute_value:1;
		unsigned rA_fixed10:1;
		unsigned rA_minus_one:1;
		unsigned rA_sub_reg_select_high:1;
		unsigned rA_reg_select:7;

		unsigned write_low_sub_reg:1;
		unsigned write_high_sub_reg:1;
		unsigned dst_reg:7;
		unsigned condition_code:2;
		unsigned saturate_result:1;
		unsigned scale_result:2;

		unsigned addition_disable:1;
		unsigned accumulate_result_this:1;
		unsigned accumulate_result_other:1;
		unsigned opcode:2;
	};

	struct __attribute__((packed)) {
		uint32_t part0;
		uint32_t part1;
	};
};

typedef union fragment_alu_instruction_x4 {
	struct __attribute__((packed)) {
		union fragment_alu_instruction a[4];
{'fraction_non_alphanumeric': 0.07069555302166476, 'fraction_numerical': 0.048904092233624734, 'mean_word_length': 5.936731107205624, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4525000', 'n_tokens_mistral': 3744, 'n_tokens_neox': 3433, 'n_words': 632}