1b8e80941Smrgir_function_signature * 2b8e80941Smrgumul64(void *mem_ctx, builtin_available_predicate avail) 3b8e80941Smrg{ 4b8e80941Smrg ir_function_signature *const sig = 5b8e80941Smrg new(mem_ctx) ir_function_signature(glsl_type::uvec2_type, avail); 6b8e80941Smrg ir_factory body(&sig->body, mem_ctx); 7b8e80941Smrg sig->is_defined = true; 8b8e80941Smrg 9b8e80941Smrg exec_list sig_parameters; 10b8e80941Smrg 11b8e80941Smrg ir_variable *const r0001 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, "a", ir_var_function_in); 12b8e80941Smrg sig_parameters.push_tail(r0001); 13b8e80941Smrg ir_variable *const r0002 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, "b", ir_var_function_in); 14b8e80941Smrg sig_parameters.push_tail(r0002); 15b8e80941Smrg ir_variable *const r0003 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, "result", ir_var_auto); 16b8e80941Smrg body.emit(r0003); 17b8e80941Smrg body.emit(assign(r0003, imul_high(swizzle_x(r0001), swizzle_x(r0002)), 0x02)); 18b8e80941Smrg 19b8e80941Smrg body.emit(assign(r0003, mul(swizzle_x(r0001), swizzle_x(r0002)), 0x01)); 20b8e80941Smrg 21b8e80941Smrg ir_expression *const r0004 = mul(swizzle_x(r0001), swizzle_y(r0002)); 22b8e80941Smrg ir_expression *const r0005 = mul(swizzle_y(r0001), swizzle_x(r0002)); 23b8e80941Smrg ir_expression *const r0006 = add(r0004, r0005); 24b8e80941Smrg body.emit(assign(r0003, add(swizzle_y(r0003), r0006), 0x02)); 25b8e80941Smrg 26b8e80941Smrg body.emit(ret(r0003)); 27b8e80941Smrg 28b8e80941Smrg sig->replace_parameters(&sig_parameters); 29b8e80941Smrg return sig; 30b8e80941Smrg} 31b8e80941Smrgir_function_signature * 32b8e80941Smrgsign64(void *mem_ctx, builtin_available_predicate avail) 33b8e80941Smrg{ 34b8e80941Smrg ir_function_signature *const sig = 35b8e80941Smrg new(mem_ctx) ir_function_signature(glsl_type::ivec2_type, avail); 36b8e80941Smrg ir_factory body(&sig->body, mem_ctx); 37b8e80941Smrg sig->is_defined = true; 38b8e80941Smrg 39b8e80941Smrg exec_list sig_parameters; 40b8e80941Smrg 41b8e80941Smrg ir_variable *const r0007 = new(mem_ctx) ir_variable(glsl_type::ivec2_type, "a", ir_var_function_in); 42b8e80941Smrg sig_parameters.push_tail(r0007); 43b8e80941Smrg ir_variable *const r0008 = new(mem_ctx) ir_variable(glsl_type::ivec2_type, "result", ir_var_auto); 44b8e80941Smrg body.emit(r0008); 45b8e80941Smrg body.emit(assign(r0008, rshift(swizzle_y(r0007), body.constant(int(31))), 0x02)); 46b8e80941Smrg 47b8e80941Smrg ir_expression *const r0009 = bit_or(swizzle_x(r0007), swizzle_y(r0007)); 48b8e80941Smrg ir_expression *const r000A = nequal(r0009, body.constant(int(0))); 49b8e80941Smrg ir_expression *const r000B = expr(ir_unop_b2i, r000A); 50b8e80941Smrg body.emit(assign(r0008, bit_or(swizzle_y(r0008), r000B), 0x01)); 51b8e80941Smrg 52b8e80941Smrg body.emit(ret(r0008)); 53b8e80941Smrg 54b8e80941Smrg sig->replace_parameters(&sig_parameters); 55b8e80941Smrg return sig; 56b8e80941Smrg} 57b8e80941Smrgir_function_signature * 58b8e80941Smrgudivmod64(void *mem_ctx, builtin_available_predicate avail) 59b8e80941Smrg{ 60b8e80941Smrg ir_function_signature *const sig = 61b8e80941Smrg new(mem_ctx) ir_function_signature(glsl_type::uvec4_type, avail); 62b8e80941Smrg ir_factory body(&sig->body, mem_ctx); 63b8e80941Smrg sig->is_defined = true; 64b8e80941Smrg 65b8e80941Smrg exec_list sig_parameters; 66b8e80941Smrg 67b8e80941Smrg ir_variable *const r000C = new(mem_ctx) ir_variable(glsl_type::uvec2_type, "n", ir_var_function_in); 68b8e80941Smrg sig_parameters.push_tail(r000C); 69b8e80941Smrg ir_variable *const r000D = new(mem_ctx) ir_variable(glsl_type::uvec2_type, "d", ir_var_function_in); 70b8e80941Smrg sig_parameters.push_tail(r000D); 71b8e80941Smrg ir_variable *const r000E = new(mem_ctx) ir_variable(glsl_type::int_type, "i", ir_var_auto); 72b8e80941Smrg body.emit(r000E); 73b8e80941Smrg ir_variable *const r000F = new(mem_ctx) ir_variable(glsl_type::uint64_t_type, "n64", ir_var_auto); 74b8e80941Smrg body.emit(r000F); 75b8e80941Smrg ir_variable *const r0010 = new(mem_ctx) ir_variable(glsl_type::int_type, "log2_denom", ir_var_auto); 76b8e80941Smrg body.emit(r0010); 77b8e80941Smrg ir_variable *const r0011 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, "quot", ir_var_auto); 78b8e80941Smrg body.emit(r0011); 79b8e80941Smrg body.emit(assign(r0011, ir_constant::zero(mem_ctx, glsl_type::uvec2_type), 0x03)); 80b8e80941Smrg 81b8e80941Smrg ir_expression *const r0012 = expr(ir_unop_find_msb, swizzle_y(r000D)); 82b8e80941Smrg body.emit(assign(r0010, add(r0012, body.constant(int(32))), 0x01)); 83b8e80941Smrg 84b8e80941Smrg /* IF CONDITION */ 85b8e80941Smrg ir_expression *const r0014 = equal(swizzle_y(r000D), body.constant(0u)); 86b8e80941Smrg ir_expression *const r0015 = gequal(swizzle_y(r000C), swizzle_x(r000D)); 87b8e80941Smrg ir_expression *const r0016 = logic_and(r0014, r0015); 88b8e80941Smrg ir_if *f0013 = new(mem_ctx) ir_if(operand(r0016).val); 89b8e80941Smrg exec_list *const f0013_parent_instructions = body.instructions; 90b8e80941Smrg 91b8e80941Smrg /* THEN INSTRUCTIONS */ 92b8e80941Smrg body.instructions = &f0013->then_instructions; 93b8e80941Smrg 94b8e80941Smrg ir_variable *const r0017 = new(mem_ctx) ir_variable(glsl_type::int_type, "i", ir_var_auto); 95b8e80941Smrg body.emit(r0017); 96b8e80941Smrg ir_variable *const r0018 = body.make_temp(glsl_type::int_type, "findMSB_retval"); 97b8e80941Smrg body.emit(assign(r0018, expr(ir_unop_find_msb, swizzle_x(r000D)), 0x01)); 98b8e80941Smrg 99b8e80941Smrg body.emit(assign(r0010, r0018, 0x01)); 100b8e80941Smrg 101b8e80941Smrg body.emit(assign(r0017, body.constant(int(31)), 0x01)); 102b8e80941Smrg 103b8e80941Smrg /* LOOP BEGIN */ 104b8e80941Smrg ir_loop *f0019 = new(mem_ctx) ir_loop(); 105b8e80941Smrg exec_list *const f0019_parent_instructions = body.instructions; 106b8e80941Smrg 107b8e80941Smrg body.instructions = &f0019->body_instructions; 108b8e80941Smrg 109b8e80941Smrg /* IF CONDITION */ 110b8e80941Smrg ir_expression *const r001B = less(r0017, body.constant(int(1))); 111b8e80941Smrg ir_if *f001A = new(mem_ctx) ir_if(operand(r001B).val); 112b8e80941Smrg exec_list *const f001A_parent_instructions = body.instructions; 113b8e80941Smrg 114b8e80941Smrg /* THEN INSTRUCTIONS */ 115b8e80941Smrg body.instructions = &f001A->then_instructions; 116b8e80941Smrg 117b8e80941Smrg body.emit(new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_break)); 118b8e80941Smrg 119b8e80941Smrg 120b8e80941Smrg body.instructions = f001A_parent_instructions; 121b8e80941Smrg body.emit(f001A); 122b8e80941Smrg 123b8e80941Smrg /* END IF */ 124b8e80941Smrg 125b8e80941Smrg /* IF CONDITION */ 126b8e80941Smrg ir_expression *const r001D = sub(body.constant(int(31)), r0017); 127b8e80941Smrg ir_expression *const r001E = lequal(r0018, r001D); 128b8e80941Smrg ir_expression *const r001F = lshift(swizzle_x(r000D), r0017); 129b8e80941Smrg ir_expression *const r0020 = lequal(r001F, swizzle_y(r000C)); 130b8e80941Smrg ir_expression *const r0021 = logic_and(r001E, r0020); 131b8e80941Smrg ir_if *f001C = new(mem_ctx) ir_if(operand(r0021).val); 132b8e80941Smrg exec_list *const f001C_parent_instructions = body.instructions; 133b8e80941Smrg 134b8e80941Smrg /* THEN INSTRUCTIONS */ 135b8e80941Smrg body.instructions = &f001C->then_instructions; 136b8e80941Smrg 137b8e80941Smrg ir_expression *const r0022 = lshift(swizzle_x(r000D), r0017); 138b8e80941Smrg body.emit(assign(r000C, sub(swizzle_y(r000C), r0022), 0x02)); 139b8e80941Smrg 140b8e80941Smrg ir_expression *const r0023 = lshift(body.constant(1u), r0017); 141b8e80941Smrg body.emit(assign(r0011, bit_or(swizzle_y(r0011), r0023), 0x02)); 142b8e80941Smrg 143b8e80941Smrg 144b8e80941Smrg body.instructions = f001C_parent_instructions; 145b8e80941Smrg body.emit(f001C); 146b8e80941Smrg 147b8e80941Smrg /* END IF */ 148b8e80941Smrg 149b8e80941Smrg body.emit(assign(r0017, add(r0017, body.constant(int(-1))), 0x01)); 150b8e80941Smrg 151b8e80941Smrg /* LOOP END */ 152b8e80941Smrg 153b8e80941Smrg body.instructions = f0019_parent_instructions; 154b8e80941Smrg body.emit(f0019); 155b8e80941Smrg 156b8e80941Smrg /* IF CONDITION */ 157b8e80941Smrg ir_expression *const r0025 = lequal(swizzle_x(r000D), swizzle_y(r000C)); 158b8e80941Smrg ir_if *f0024 = new(mem_ctx) ir_if(operand(r0025).val); 159b8e80941Smrg exec_list *const f0024_parent_instructions = body.instructions; 160b8e80941Smrg 161b8e80941Smrg /* THEN INSTRUCTIONS */ 162b8e80941Smrg body.instructions = &f0024->then_instructions; 163b8e80941Smrg 164b8e80941Smrg body.emit(assign(r000C, sub(swizzle_y(r000C), swizzle_x(r000D)), 0x02)); 165b8e80941Smrg 166b8e80941Smrg body.emit(assign(r0011, bit_or(swizzle_y(r0011), body.constant(1u)), 0x02)); 167b8e80941Smrg 168b8e80941Smrg 169b8e80941Smrg body.instructions = f0024_parent_instructions; 170b8e80941Smrg body.emit(f0024); 171b8e80941Smrg 172b8e80941Smrg /* END IF */ 173b8e80941Smrg 174b8e80941Smrg 175b8e80941Smrg body.instructions = f0013_parent_instructions; 176b8e80941Smrg body.emit(f0013); 177b8e80941Smrg 178b8e80941Smrg /* END IF */ 179b8e80941Smrg 180b8e80941Smrg ir_variable *const r0026 = body.make_temp(glsl_type::uint64_t_type, "packUint2x32_retval"); 181b8e80941Smrg body.emit(assign(r0026, expr(ir_unop_pack_uint_2x32, r000D), 0x01)); 182b8e80941Smrg 183b8e80941Smrg body.emit(assign(r000F, expr(ir_unop_pack_uint_2x32, r000C), 0x01)); 184b8e80941Smrg 185b8e80941Smrg body.emit(assign(r000E, body.constant(int(31)), 0x01)); 186b8e80941Smrg 187b8e80941Smrg /* LOOP BEGIN */ 188b8e80941Smrg ir_loop *f0027 = new(mem_ctx) ir_loop(); 189b8e80941Smrg exec_list *const f0027_parent_instructions = body.instructions; 190b8e80941Smrg 191b8e80941Smrg body.instructions = &f0027->body_instructions; 192b8e80941Smrg 193b8e80941Smrg /* IF CONDITION */ 194b8e80941Smrg ir_expression *const r0029 = less(r000E, body.constant(int(1))); 195b8e80941Smrg ir_if *f0028 = new(mem_ctx) ir_if(operand(r0029).val); 196b8e80941Smrg exec_list *const f0028_parent_instructions = body.instructions; 197b8e80941Smrg 198b8e80941Smrg /* THEN INSTRUCTIONS */ 199b8e80941Smrg body.instructions = &f0028->then_instructions; 200b8e80941Smrg 201b8e80941Smrg body.emit(new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_break)); 202b8e80941Smrg 203b8e80941Smrg 204b8e80941Smrg body.instructions = f0028_parent_instructions; 205b8e80941Smrg body.emit(f0028); 206b8e80941Smrg 207b8e80941Smrg /* END IF */ 208b8e80941Smrg 209b8e80941Smrg /* IF CONDITION */ 210b8e80941Smrg ir_expression *const r002B = sub(body.constant(int(63)), r000E); 211b8e80941Smrg ir_expression *const r002C = lequal(r0010, r002B); 212b8e80941Smrg ir_expression *const r002D = lshift(r0026, r000E); 213b8e80941Smrg ir_expression *const r002E = lequal(r002D, r000F); 214b8e80941Smrg ir_expression *const r002F = logic_and(r002C, r002E); 215b8e80941Smrg ir_if *f002A = new(mem_ctx) ir_if(operand(r002F).val); 216b8e80941Smrg exec_list *const f002A_parent_instructions = body.instructions; 217b8e80941Smrg 218b8e80941Smrg /* THEN INSTRUCTIONS */ 219b8e80941Smrg body.instructions = &f002A->then_instructions; 220b8e80941Smrg 221b8e80941Smrg ir_expression *const r0030 = lshift(r0026, r000E); 222b8e80941Smrg body.emit(assign(r000F, sub(r000F, r0030), 0x01)); 223b8e80941Smrg 224b8e80941Smrg ir_expression *const r0031 = lshift(body.constant(1u), r000E); 225b8e80941Smrg body.emit(assign(r0011, bit_or(swizzle_x(r0011), r0031), 0x01)); 226b8e80941Smrg 227b8e80941Smrg 228b8e80941Smrg body.instructions = f002A_parent_instructions; 229b8e80941Smrg body.emit(f002A); 230b8e80941Smrg 231b8e80941Smrg /* END IF */ 232b8e80941Smrg 233b8e80941Smrg body.emit(assign(r000E, add(r000E, body.constant(int(-1))), 0x01)); 234b8e80941Smrg 235b8e80941Smrg /* LOOP END */ 236b8e80941Smrg 237b8e80941Smrg body.instructions = f0027_parent_instructions; 238b8e80941Smrg body.emit(f0027); 239b8e80941Smrg 240b8e80941Smrg /* IF CONDITION */ 241b8e80941Smrg ir_expression *const r0033 = lequal(r0026, r000F); 242b8e80941Smrg ir_if *f0032 = new(mem_ctx) ir_if(operand(r0033).val); 243b8e80941Smrg exec_list *const f0032_parent_instructions = body.instructions; 244b8e80941Smrg 245b8e80941Smrg /* THEN INSTRUCTIONS */ 246b8e80941Smrg body.instructions = &f0032->then_instructions; 247b8e80941Smrg 248b8e80941Smrg body.emit(assign(r000F, sub(r000F, r0026), 0x01)); 249b8e80941Smrg 250b8e80941Smrg body.emit(assign(r0011, bit_or(swizzle_x(r0011), body.constant(1u)), 0x01)); 251b8e80941Smrg 252b8e80941Smrg 253b8e80941Smrg body.instructions = f0032_parent_instructions; 254b8e80941Smrg body.emit(f0032); 255b8e80941Smrg 256b8e80941Smrg /* END IF */ 257b8e80941Smrg 258b8e80941Smrg ir_variable *const r0034 = body.make_temp(glsl_type::uvec4_type, "vec_ctor"); 259b8e80941Smrg body.emit(assign(r0034, r0011, 0x03)); 260b8e80941Smrg 261b8e80941Smrg body.emit(assign(r0034, expr(ir_unop_unpack_uint_2x32, r000F), 0x0c)); 262b8e80941Smrg 263b8e80941Smrg body.emit(ret(r0034)); 264b8e80941Smrg 265b8e80941Smrg sig->replace_parameters(&sig_parameters); 266b8e80941Smrg return sig; 267b8e80941Smrg} 268b8e80941Smrgir_function_signature * 269b8e80941Smrgudiv64(void *mem_ctx, builtin_available_predicate avail) 270b8e80941Smrg{ 271b8e80941Smrg ir_function_signature *const sig = 272b8e80941Smrg new(mem_ctx) ir_function_signature(glsl_type::uvec2_type, avail); 273b8e80941Smrg ir_factory body(&sig->body, mem_ctx); 274b8e80941Smrg sig->is_defined = true; 275b8e80941Smrg 276b8e80941Smrg exec_list sig_parameters; 277b8e80941Smrg 278b8e80941Smrg ir_variable *const r0035 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, "n", ir_var_function_in); 279b8e80941Smrg sig_parameters.push_tail(r0035); 280b8e80941Smrg ir_variable *const r0036 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, "d", ir_var_function_in); 281b8e80941Smrg sig_parameters.push_tail(r0036); 282b8e80941Smrg ir_variable *const r0037 = body.make_temp(glsl_type::uvec2_type, "n"); 283b8e80941Smrg body.emit(assign(r0037, r0035, 0x03)); 284b8e80941Smrg 285b8e80941Smrg ir_variable *const r0038 = new(mem_ctx) ir_variable(glsl_type::int_type, "i", ir_var_auto); 286b8e80941Smrg body.emit(r0038); 287b8e80941Smrg ir_variable *const r0039 = new(mem_ctx) ir_variable(glsl_type::uint64_t_type, "n64", ir_var_auto); 288b8e80941Smrg body.emit(r0039); 289b8e80941Smrg ir_variable *const r003A = new(mem_ctx) ir_variable(glsl_type::int_type, "log2_denom", ir_var_auto); 290b8e80941Smrg body.emit(r003A); 291b8e80941Smrg ir_variable *const r003B = new(mem_ctx) ir_variable(glsl_type::uvec2_type, "quot", ir_var_auto); 292b8e80941Smrg body.emit(r003B); 293b8e80941Smrg body.emit(assign(r003B, ir_constant::zero(mem_ctx, glsl_type::uvec2_type), 0x03)); 294b8e80941Smrg 295b8e80941Smrg ir_expression *const r003C = expr(ir_unop_find_msb, swizzle_y(r0036)); 296b8e80941Smrg body.emit(assign(r003A, add(r003C, body.constant(int(32))), 0x01)); 297b8e80941Smrg 298b8e80941Smrg /* IF CONDITION */ 299b8e80941Smrg ir_expression *const r003E = equal(swizzle_y(r0036), body.constant(0u)); 300b8e80941Smrg ir_expression *const r003F = gequal(swizzle_y(r0035), swizzle_x(r0036)); 301b8e80941Smrg ir_expression *const r0040 = logic_and(r003E, r003F); 302b8e80941Smrg ir_if *f003D = new(mem_ctx) ir_if(operand(r0040).val); 303b8e80941Smrg exec_list *const f003D_parent_instructions = body.instructions; 304b8e80941Smrg 305b8e80941Smrg /* THEN INSTRUCTIONS */ 306b8e80941Smrg body.instructions = &f003D->then_instructions; 307b8e80941Smrg 308b8e80941Smrg ir_variable *const r0041 = new(mem_ctx) ir_variable(glsl_type::int_type, "i", ir_var_auto); 309b8e80941Smrg body.emit(r0041); 310b8e80941Smrg ir_variable *const r0042 = body.make_temp(glsl_type::int_type, "findMSB_retval"); 311b8e80941Smrg body.emit(assign(r0042, expr(ir_unop_find_msb, swizzle_x(r0036)), 0x01)); 312b8e80941Smrg 313b8e80941Smrg body.emit(assign(r003A, r0042, 0x01)); 314b8e80941Smrg 315b8e80941Smrg body.emit(assign(r0041, body.constant(int(31)), 0x01)); 316b8e80941Smrg 317b8e80941Smrg /* LOOP BEGIN */ 318b8e80941Smrg ir_loop *f0043 = new(mem_ctx) ir_loop(); 319b8e80941Smrg exec_list *const f0043_parent_instructions = body.instructions; 320b8e80941Smrg 321b8e80941Smrg body.instructions = &f0043->body_instructions; 322b8e80941Smrg 323b8e80941Smrg /* IF CONDITION */ 324b8e80941Smrg ir_expression *const r0045 = less(r0041, body.constant(int(1))); 325b8e80941Smrg ir_if *f0044 = new(mem_ctx) ir_if(operand(r0045).val); 326b8e80941Smrg exec_list *const f0044_parent_instructions = body.instructions; 327b8e80941Smrg 328b8e80941Smrg /* THEN INSTRUCTIONS */ 329b8e80941Smrg body.instructions = &f0044->then_instructions; 330b8e80941Smrg 331b8e80941Smrg body.emit(new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_break)); 332b8e80941Smrg 333b8e80941Smrg 334b8e80941Smrg body.instructions = f0044_parent_instructions; 335b8e80941Smrg body.emit(f0044); 336b8e80941Smrg 337b8e80941Smrg /* END IF */ 338b8e80941Smrg 339b8e80941Smrg /* IF CONDITION */ 340b8e80941Smrg ir_expression *const r0047 = sub(body.constant(int(31)), r0041); 341b8e80941Smrg ir_expression *const r0048 = lequal(r0042, r0047); 342b8e80941Smrg ir_expression *const r0049 = lshift(swizzle_x(r0036), r0041); 343b8e80941Smrg ir_expression *const r004A = lequal(r0049, swizzle_y(r0037)); 344b8e80941Smrg ir_expression *const r004B = logic_and(r0048, r004A); 345b8e80941Smrg ir_if *f0046 = new(mem_ctx) ir_if(operand(r004B).val); 346b8e80941Smrg exec_list *const f0046_parent_instructions = body.instructions; 347b8e80941Smrg 348b8e80941Smrg /* THEN INSTRUCTIONS */ 349b8e80941Smrg body.instructions = &f0046->then_instructions; 350b8e80941Smrg 351b8e80941Smrg ir_expression *const r004C = lshift(swizzle_x(r0036), r0041); 352b8e80941Smrg body.emit(assign(r0037, sub(swizzle_y(r0037), r004C), 0x02)); 353b8e80941Smrg 354b8e80941Smrg ir_expression *const r004D = lshift(body.constant(1u), r0041); 355b8e80941Smrg body.emit(assign(r003B, bit_or(swizzle_y(r003B), r004D), 0x02)); 356b8e80941Smrg 357b8e80941Smrg 358b8e80941Smrg body.instructions = f0046_parent_instructions; 359b8e80941Smrg body.emit(f0046); 360b8e80941Smrg 361b8e80941Smrg /* END IF */ 362b8e80941Smrg 363b8e80941Smrg body.emit(assign(r0041, add(r0041, body.constant(int(-1))), 0x01)); 364b8e80941Smrg 365b8e80941Smrg /* LOOP END */ 366b8e80941Smrg 367b8e80941Smrg body.instructions = f0043_parent_instructions; 368b8e80941Smrg body.emit(f0043); 369b8e80941Smrg 370b8e80941Smrg /* IF CONDITION */ 371b8e80941Smrg ir_expression *const r004F = lequal(swizzle_x(r0036), swizzle_y(r0037)); 372b8e80941Smrg ir_if *f004E = new(mem_ctx) ir_if(operand(r004F).val); 373b8e80941Smrg exec_list *const f004E_parent_instructions = body.instructions; 374b8e80941Smrg 375b8e80941Smrg /* THEN INSTRUCTIONS */ 376b8e80941Smrg body.instructions = &f004E->then_instructions; 377b8e80941Smrg 378b8e80941Smrg body.emit(assign(r0037, sub(swizzle_y(r0037), swizzle_x(r0036)), 0x02)); 379b8e80941Smrg 380b8e80941Smrg body.emit(assign(r003B, bit_or(swizzle_y(r003B), body.constant(1u)), 0x02)); 381b8e80941Smrg 382b8e80941Smrg 383b8e80941Smrg body.instructions = f004E_parent_instructions; 384b8e80941Smrg body.emit(f004E); 385b8e80941Smrg 386b8e80941Smrg /* END IF */ 387b8e80941Smrg 388b8e80941Smrg 389b8e80941Smrg body.instructions = f003D_parent_instructions; 390b8e80941Smrg body.emit(f003D); 391b8e80941Smrg 392b8e80941Smrg /* END IF */ 393b8e80941Smrg 394b8e80941Smrg ir_variable *const r0050 = body.make_temp(glsl_type::uint64_t_type, "packUint2x32_retval"); 395b8e80941Smrg body.emit(assign(r0050, expr(ir_unop_pack_uint_2x32, r0036), 0x01)); 396b8e80941Smrg 397b8e80941Smrg body.emit(assign(r0039, expr(ir_unop_pack_uint_2x32, r0037), 0x01)); 398b8e80941Smrg 399b8e80941Smrg body.emit(assign(r0038, body.constant(int(31)), 0x01)); 400b8e80941Smrg 401b8e80941Smrg /* LOOP BEGIN */ 402b8e80941Smrg ir_loop *f0051 = new(mem_ctx) ir_loop(); 403b8e80941Smrg exec_list *const f0051_parent_instructions = body.instructions; 404b8e80941Smrg 405b8e80941Smrg body.instructions = &f0051->body_instructions; 406b8e80941Smrg 407b8e80941Smrg /* IF CONDITION */ 408b8e80941Smrg ir_expression *const r0053 = less(r0038, body.constant(int(1))); 409b8e80941Smrg ir_if *f0052 = new(mem_ctx) ir_if(operand(r0053).val); 410b8e80941Smrg exec_list *const f0052_parent_instructions = body.instructions; 411b8e80941Smrg 412b8e80941Smrg /* THEN INSTRUCTIONS */ 413b8e80941Smrg body.instructions = &f0052->then_instructions; 414b8e80941Smrg 415b8e80941Smrg body.emit(new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_break)); 416b8e80941Smrg 417b8e80941Smrg 418b8e80941Smrg body.instructions = f0052_parent_instructions; 419b8e80941Smrg body.emit(f0052); 420b8e80941Smrg 421b8e80941Smrg /* END IF */ 422b8e80941Smrg 423b8e80941Smrg /* IF CONDITION */ 424b8e80941Smrg ir_expression *const r0055 = sub(body.constant(int(63)), r0038); 425b8e80941Smrg ir_expression *const r0056 = lequal(r003A, r0055); 426b8e80941Smrg ir_expression *const r0057 = lshift(r0050, r0038); 427b8e80941Smrg ir_expression *const r0058 = lequal(r0057, r0039); 428b8e80941Smrg ir_expression *const r0059 = logic_and(r0056, r0058); 429b8e80941Smrg ir_if *f0054 = new(mem_ctx) ir_if(operand(r0059).val); 430b8e80941Smrg exec_list *const f0054_parent_instructions = body.instructions; 431b8e80941Smrg 432b8e80941Smrg /* THEN INSTRUCTIONS */ 433b8e80941Smrg body.instructions = &f0054->then_instructions; 434b8e80941Smrg 435b8e80941Smrg ir_expression *const r005A = lshift(r0050, r0038); 436b8e80941Smrg body.emit(assign(r0039, sub(r0039, r005A), 0x01)); 437b8e80941Smrg 438b8e80941Smrg ir_expression *const r005B = lshift(body.constant(1u), r0038); 439b8e80941Smrg body.emit(assign(r003B, bit_or(swizzle_x(r003B), r005B), 0x01)); 440b8e80941Smrg 441b8e80941Smrg 442b8e80941Smrg body.instructions = f0054_parent_instructions; 443b8e80941Smrg body.emit(f0054); 444b8e80941Smrg 445b8e80941Smrg /* END IF */ 446b8e80941Smrg 447b8e80941Smrg body.emit(assign(r0038, add(r0038, body.constant(int(-1))), 0x01)); 448b8e80941Smrg 449b8e80941Smrg /* LOOP END */ 450b8e80941Smrg 451b8e80941Smrg body.instructions = f0051_parent_instructions; 452b8e80941Smrg body.emit(f0051); 453b8e80941Smrg 454b8e80941Smrg /* IF CONDITION */ 455b8e80941Smrg ir_expression *const r005D = lequal(r0050, r0039); 456b8e80941Smrg ir_if *f005C = new(mem_ctx) ir_if(operand(r005D).val); 457b8e80941Smrg exec_list *const f005C_parent_instructions = body.instructions; 458b8e80941Smrg 459b8e80941Smrg /* THEN INSTRUCTIONS */ 460b8e80941Smrg body.instructions = &f005C->then_instructions; 461b8e80941Smrg 462b8e80941Smrg body.emit(assign(r0039, sub(r0039, r0050), 0x01)); 463b8e80941Smrg 464b8e80941Smrg body.emit(assign(r003B, bit_or(swizzle_x(r003B), body.constant(1u)), 0x01)); 465b8e80941Smrg 466b8e80941Smrg 467b8e80941Smrg body.instructions = f005C_parent_instructions; 468b8e80941Smrg body.emit(f005C); 469b8e80941Smrg 470b8e80941Smrg /* END IF */ 471b8e80941Smrg 472b8e80941Smrg body.emit(ret(r003B)); 473b8e80941Smrg 474b8e80941Smrg sig->replace_parameters(&sig_parameters); 475b8e80941Smrg return sig; 476b8e80941Smrg} 477b8e80941Smrgir_function_signature * 478b8e80941Smrgidiv64(void *mem_ctx, builtin_available_predicate avail) 479b8e80941Smrg{ 480b8e80941Smrg ir_function_signature *const sig = 481b8e80941Smrg new(mem_ctx) ir_function_signature(glsl_type::ivec2_type, avail); 482b8e80941Smrg ir_factory body(&sig->body, mem_ctx); 483b8e80941Smrg sig->is_defined = true; 484b8e80941Smrg 485b8e80941Smrg exec_list sig_parameters; 486b8e80941Smrg 487b8e80941Smrg ir_variable *const r005E = new(mem_ctx) ir_variable(glsl_type::ivec2_type, "_n", ir_var_function_in); 488b8e80941Smrg sig_parameters.push_tail(r005E); 489b8e80941Smrg ir_variable *const r005F = new(mem_ctx) ir_variable(glsl_type::ivec2_type, "_d", ir_var_function_in); 490b8e80941Smrg sig_parameters.push_tail(r005F); 491b8e80941Smrg ir_variable *const r0060 = new(mem_ctx) ir_variable(glsl_type::bool_type, "negate", ir_var_auto); 492b8e80941Smrg body.emit(r0060); 493b8e80941Smrg ir_expression *const r0061 = less(swizzle_y(r005E), body.constant(int(0))); 494b8e80941Smrg ir_expression *const r0062 = less(swizzle_y(r005F), body.constant(int(0))); 495b8e80941Smrg body.emit(assign(r0060, nequal(r0061, r0062), 0x01)); 496b8e80941Smrg 497b8e80941Smrg ir_variable *const r0063 = body.make_temp(glsl_type::uvec2_type, "n"); 498b8e80941Smrg ir_expression *const r0064 = expr(ir_unop_pack_int_2x32, r005E); 499b8e80941Smrg ir_expression *const r0065 = expr(ir_unop_abs, r0064); 500b8e80941Smrg ir_expression *const r0066 = expr(ir_unop_i642u64, r0065); 501b8e80941Smrg body.emit(assign(r0063, expr(ir_unop_unpack_uint_2x32, r0066), 0x03)); 502b8e80941Smrg 503b8e80941Smrg ir_variable *const r0067 = body.make_temp(glsl_type::uvec2_type, "d"); 504b8e80941Smrg ir_expression *const r0068 = expr(ir_unop_pack_int_2x32, r005F); 505b8e80941Smrg ir_expression *const r0069 = expr(ir_unop_abs, r0068); 506b8e80941Smrg ir_expression *const r006A = expr(ir_unop_i642u64, r0069); 507b8e80941Smrg body.emit(assign(r0067, expr(ir_unop_unpack_uint_2x32, r006A), 0x03)); 508b8e80941Smrg 509b8e80941Smrg ir_variable *const r006B = new(mem_ctx) ir_variable(glsl_type::int_type, "i", ir_var_auto); 510b8e80941Smrg body.emit(r006B); 511b8e80941Smrg ir_variable *const r006C = new(mem_ctx) ir_variable(glsl_type::uint64_t_type, "n64", ir_var_auto); 512b8e80941Smrg body.emit(r006C); 513b8e80941Smrg ir_variable *const r006D = new(mem_ctx) ir_variable(glsl_type::int_type, "log2_denom", ir_var_auto); 514b8e80941Smrg body.emit(r006D); 515b8e80941Smrg ir_variable *const r006E = new(mem_ctx) ir_variable(glsl_type::uvec2_type, "quot", ir_var_auto); 516b8e80941Smrg body.emit(r006E); 517b8e80941Smrg body.emit(assign(r006E, ir_constant::zero(mem_ctx, glsl_type::uvec2_type), 0x03)); 518b8e80941Smrg 519b8e80941Smrg ir_expression *const r006F = expr(ir_unop_find_msb, swizzle_y(r0067)); 520b8e80941Smrg body.emit(assign(r006D, add(r006F, body.constant(int(32))), 0x01)); 521b8e80941Smrg 522b8e80941Smrg /* IF CONDITION */ 523b8e80941Smrg ir_expression *const r0071 = equal(swizzle_y(r0067), body.constant(0u)); 524b8e80941Smrg ir_expression *const r0072 = gequal(swizzle_y(r0063), swizzle_x(r0067)); 525b8e80941Smrg ir_expression *const r0073 = logic_and(r0071, r0072); 526b8e80941Smrg ir_if *f0070 = new(mem_ctx) ir_if(operand(r0073).val); 527b8e80941Smrg exec_list *const f0070_parent_instructions = body.instructions; 528b8e80941Smrg 529b8e80941Smrg /* THEN INSTRUCTIONS */ 530b8e80941Smrg body.instructions = &f0070->then_instructions; 531b8e80941Smrg 532b8e80941Smrg ir_variable *const r0074 = new(mem_ctx) ir_variable(glsl_type::int_type, "i", ir_var_auto); 533b8e80941Smrg body.emit(r0074); 534b8e80941Smrg ir_variable *const r0075 = body.make_temp(glsl_type::int_type, "findMSB_retval"); 535b8e80941Smrg body.emit(assign(r0075, expr(ir_unop_find_msb, swizzle_x(r0067)), 0x01)); 536b8e80941Smrg 537b8e80941Smrg body.emit(assign(r006D, r0075, 0x01)); 538b8e80941Smrg 539b8e80941Smrg body.emit(assign(r0074, body.constant(int(31)), 0x01)); 540b8e80941Smrg 541b8e80941Smrg /* LOOP BEGIN */ 542b8e80941Smrg ir_loop *f0076 = new(mem_ctx) ir_loop(); 543b8e80941Smrg exec_list *const f0076_parent_instructions = body.instructions; 544b8e80941Smrg 545b8e80941Smrg body.instructions = &f0076->body_instructions; 546b8e80941Smrg 547b8e80941Smrg /* IF CONDITION */ 548b8e80941Smrg ir_expression *const r0078 = less(r0074, body.constant(int(1))); 549b8e80941Smrg ir_if *f0077 = new(mem_ctx) ir_if(operand(r0078).val); 550b8e80941Smrg exec_list *const f0077_parent_instructions = body.instructions; 551b8e80941Smrg 552b8e80941Smrg /* THEN INSTRUCTIONS */ 553b8e80941Smrg body.instructions = &f0077->then_instructions; 554b8e80941Smrg 555b8e80941Smrg body.emit(new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_break)); 556b8e80941Smrg 557b8e80941Smrg 558b8e80941Smrg body.instructions = f0077_parent_instructions; 559b8e80941Smrg body.emit(f0077); 560b8e80941Smrg 561b8e80941Smrg /* END IF */ 562b8e80941Smrg 563b8e80941Smrg /* IF CONDITION */ 564b8e80941Smrg ir_expression *const r007A = sub(body.constant(int(31)), r0074); 565b8e80941Smrg ir_expression *const r007B = lequal(r0075, r007A); 566b8e80941Smrg ir_expression *const r007C = lshift(swizzle_x(r0067), r0074); 567b8e80941Smrg ir_expression *const r007D = lequal(r007C, swizzle_y(r0063)); 568b8e80941Smrg ir_expression *const r007E = logic_and(r007B, r007D); 569b8e80941Smrg ir_if *f0079 = new(mem_ctx) ir_if(operand(r007E).val); 570b8e80941Smrg exec_list *const f0079_parent_instructions = body.instructions; 571b8e80941Smrg 572b8e80941Smrg /* THEN INSTRUCTIONS */ 573b8e80941Smrg body.instructions = &f0079->then_instructions; 574b8e80941Smrg 575b8e80941Smrg ir_expression *const r007F = lshift(swizzle_x(r0067), r0074); 576b8e80941Smrg body.emit(assign(r0063, sub(swizzle_y(r0063), r007F), 0x02)); 577b8e80941Smrg 578b8e80941Smrg ir_expression *const r0080 = lshift(body.constant(1u), r0074); 579b8e80941Smrg body.emit(assign(r006E, bit_or(swizzle_y(r006E), r0080), 0x02)); 580b8e80941Smrg 581b8e80941Smrg 582b8e80941Smrg body.instructions = f0079_parent_instructions; 583b8e80941Smrg body.emit(f0079); 584b8e80941Smrg 585b8e80941Smrg /* END IF */ 586b8e80941Smrg 587b8e80941Smrg body.emit(assign(r0074, add(r0074, body.constant(int(-1))), 0x01)); 588b8e80941Smrg 589b8e80941Smrg /* LOOP END */ 590b8e80941Smrg 591b8e80941Smrg body.instructions = f0076_parent_instructions; 592b8e80941Smrg body.emit(f0076); 593b8e80941Smrg 594b8e80941Smrg /* IF CONDITION */ 595b8e80941Smrg ir_expression *const r0082 = lequal(swizzle_x(r0067), swizzle_y(r0063)); 596b8e80941Smrg ir_if *f0081 = new(mem_ctx) ir_if(operand(r0082).val); 597b8e80941Smrg exec_list *const f0081_parent_instructions = body.instructions; 598b8e80941Smrg 599b8e80941Smrg /* THEN INSTRUCTIONS */ 600b8e80941Smrg body.instructions = &f0081->then_instructions; 601b8e80941Smrg 602b8e80941Smrg body.emit(assign(r0063, sub(swizzle_y(r0063), swizzle_x(r0067)), 0x02)); 603b8e80941Smrg 604b8e80941Smrg body.emit(assign(r006E, bit_or(swizzle_y(r006E), body.constant(1u)), 0x02)); 605b8e80941Smrg 606b8e80941Smrg 607b8e80941Smrg body.instructions = f0081_parent_instructions; 608b8e80941Smrg body.emit(f0081); 609b8e80941Smrg 610b8e80941Smrg /* END IF */ 611b8e80941Smrg 612b8e80941Smrg 613b8e80941Smrg body.instructions = f0070_parent_instructions; 614b8e80941Smrg body.emit(f0070); 615b8e80941Smrg 616b8e80941Smrg /* END IF */ 617b8e80941Smrg 618b8e80941Smrg ir_variable *const r0083 = body.make_temp(glsl_type::uint64_t_type, "packUint2x32_retval"); 619b8e80941Smrg body.emit(assign(r0083, expr(ir_unop_pack_uint_2x32, r0067), 0x01)); 620b8e80941Smrg 621b8e80941Smrg body.emit(assign(r006C, expr(ir_unop_pack_uint_2x32, r0063), 0x01)); 622b8e80941Smrg 623b8e80941Smrg body.emit(assign(r006B, body.constant(int(31)), 0x01)); 624b8e80941Smrg 625b8e80941Smrg /* LOOP BEGIN */ 626b8e80941Smrg ir_loop *f0084 = new(mem_ctx) ir_loop(); 627b8e80941Smrg exec_list *const f0084_parent_instructions = body.instructions; 628b8e80941Smrg 629b8e80941Smrg body.instructions = &f0084->body_instructions; 630b8e80941Smrg 631b8e80941Smrg /* IF CONDITION */ 632b8e80941Smrg ir_expression *const r0086 = less(r006B, body.constant(int(1))); 633b8e80941Smrg ir_if *f0085 = new(mem_ctx) ir_if(operand(r0086).val); 634b8e80941Smrg exec_list *const f0085_parent_instructions = body.instructions; 635b8e80941Smrg 636b8e80941Smrg /* THEN INSTRUCTIONS */ 637b8e80941Smrg body.instructions = &f0085->then_instructions; 638b8e80941Smrg 639b8e80941Smrg body.emit(new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_break)); 640b8e80941Smrg 641b8e80941Smrg 642b8e80941Smrg body.instructions = f0085_parent_instructions; 643b8e80941Smrg body.emit(f0085); 644b8e80941Smrg 645b8e80941Smrg /* END IF */ 646b8e80941Smrg 647b8e80941Smrg /* IF CONDITION */ 648b8e80941Smrg ir_expression *const r0088 = sub(body.constant(int(63)), r006B); 649b8e80941Smrg ir_expression *const r0089 = lequal(r006D, r0088); 650b8e80941Smrg ir_expression *const r008A = lshift(r0083, r006B); 651b8e80941Smrg ir_expression *const r008B = lequal(r008A, r006C); 652b8e80941Smrg ir_expression *const r008C = logic_and(r0089, r008B); 653b8e80941Smrg ir_if *f0087 = new(mem_ctx) ir_if(operand(r008C).val); 654b8e80941Smrg exec_list *const f0087_parent_instructions = body.instructions; 655b8e80941Smrg 656b8e80941Smrg /* THEN INSTRUCTIONS */ 657b8e80941Smrg body.instructions = &f0087->then_instructions; 658b8e80941Smrg 659b8e80941Smrg ir_expression *const r008D = lshift(r0083, r006B); 660b8e80941Smrg body.emit(assign(r006C, sub(r006C, r008D), 0x01)); 661b8e80941Smrg 662b8e80941Smrg ir_expression *const r008E = lshift(body.constant(1u), r006B); 663b8e80941Smrg body.emit(assign(r006E, bit_or(swizzle_x(r006E), r008E), 0x01)); 664b8e80941Smrg 665b8e80941Smrg 666b8e80941Smrg body.instructions = f0087_parent_instructions; 667b8e80941Smrg body.emit(f0087); 668b8e80941Smrg 669b8e80941Smrg /* END IF */ 670b8e80941Smrg 671b8e80941Smrg body.emit(assign(r006B, add(r006B, body.constant(int(-1))), 0x01)); 672b8e80941Smrg 673b8e80941Smrg /* LOOP END */ 674b8e80941Smrg 675b8e80941Smrg body.instructions = f0084_parent_instructions; 676b8e80941Smrg body.emit(f0084); 677b8e80941Smrg 678b8e80941Smrg /* IF CONDITION */ 679b8e80941Smrg ir_expression *const r0090 = lequal(r0083, r006C); 680b8e80941Smrg ir_if *f008F = new(mem_ctx) ir_if(operand(r0090).val); 681b8e80941Smrg exec_list *const f008F_parent_instructions = body.instructions; 682b8e80941Smrg 683b8e80941Smrg /* THEN INSTRUCTIONS */ 684b8e80941Smrg body.instructions = &f008F->then_instructions; 685b8e80941Smrg 686b8e80941Smrg body.emit(assign(r006C, sub(r006C, r0083), 0x01)); 687b8e80941Smrg 688b8e80941Smrg body.emit(assign(r006E, bit_or(swizzle_x(r006E), body.constant(1u)), 0x01)); 689b8e80941Smrg 690b8e80941Smrg 691b8e80941Smrg body.instructions = f008F_parent_instructions; 692b8e80941Smrg body.emit(f008F); 693b8e80941Smrg 694b8e80941Smrg /* END IF */ 695b8e80941Smrg 696b8e80941Smrg ir_variable *const r0091 = body.make_temp(glsl_type::ivec2_type, "conditional_tmp"); 697b8e80941Smrg /* IF CONDITION */ 698b8e80941Smrg ir_if *f0092 = new(mem_ctx) ir_if(operand(r0060).val); 699b8e80941Smrg exec_list *const f0092_parent_instructions = body.instructions; 700b8e80941Smrg 701b8e80941Smrg /* THEN INSTRUCTIONS */ 702b8e80941Smrg body.instructions = &f0092->then_instructions; 703b8e80941Smrg 704b8e80941Smrg ir_expression *const r0093 = expr(ir_unop_pack_uint_2x32, r006E); 705b8e80941Smrg ir_expression *const r0094 = expr(ir_unop_u642i64, r0093); 706b8e80941Smrg ir_expression *const r0095 = neg(r0094); 707b8e80941Smrg body.emit(assign(r0091, expr(ir_unop_unpack_int_2x32, r0095), 0x03)); 708b8e80941Smrg 709b8e80941Smrg 710b8e80941Smrg /* ELSE INSTRUCTIONS */ 711b8e80941Smrg body.instructions = &f0092->else_instructions; 712b8e80941Smrg 713b8e80941Smrg body.emit(assign(r0091, expr(ir_unop_u2i, r006E), 0x03)); 714b8e80941Smrg 715b8e80941Smrg 716b8e80941Smrg body.instructions = f0092_parent_instructions; 717b8e80941Smrg body.emit(f0092); 718b8e80941Smrg 719b8e80941Smrg /* END IF */ 720b8e80941Smrg 721b8e80941Smrg body.emit(ret(r0091)); 722b8e80941Smrg 723b8e80941Smrg sig->replace_parameters(&sig_parameters); 724b8e80941Smrg return sig; 725b8e80941Smrg} 726b8e80941Smrgir_function_signature * 727b8e80941Smrgumod64(void *mem_ctx, builtin_available_predicate avail) 728b8e80941Smrg{ 729b8e80941Smrg ir_function_signature *const sig = 730b8e80941Smrg new(mem_ctx) ir_function_signature(glsl_type::uvec2_type, avail); 731b8e80941Smrg ir_factory body(&sig->body, mem_ctx); 732b8e80941Smrg sig->is_defined = true; 733b8e80941Smrg 734b8e80941Smrg exec_list sig_parameters; 735b8e80941Smrg 736b8e80941Smrg ir_variable *const r0096 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, "n", ir_var_function_in); 737b8e80941Smrg sig_parameters.push_tail(r0096); 738b8e80941Smrg ir_variable *const r0097 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, "d", ir_var_function_in); 739b8e80941Smrg sig_parameters.push_tail(r0097); 740b8e80941Smrg ir_variable *const r0098 = body.make_temp(glsl_type::uvec2_type, "n"); 741b8e80941Smrg body.emit(assign(r0098, r0096, 0x03)); 742b8e80941Smrg 743b8e80941Smrg ir_variable *const r0099 = new(mem_ctx) ir_variable(glsl_type::int_type, "i", ir_var_auto); 744b8e80941Smrg body.emit(r0099); 745b8e80941Smrg ir_variable *const r009A = new(mem_ctx) ir_variable(glsl_type::uint64_t_type, "n64", ir_var_auto); 746b8e80941Smrg body.emit(r009A); 747b8e80941Smrg ir_variable *const r009B = new(mem_ctx) ir_variable(glsl_type::int_type, "log2_denom", ir_var_auto); 748b8e80941Smrg body.emit(r009B); 749b8e80941Smrg ir_variable *const r009C = new(mem_ctx) ir_variable(glsl_type::uvec2_type, "quot", ir_var_auto); 750b8e80941Smrg body.emit(r009C); 751b8e80941Smrg body.emit(assign(r009C, ir_constant::zero(mem_ctx, glsl_type::uvec2_type), 0x03)); 752b8e80941Smrg 753b8e80941Smrg ir_expression *const r009D = expr(ir_unop_find_msb, swizzle_y(r0097)); 754b8e80941Smrg body.emit(assign(r009B, add(r009D, body.constant(int(32))), 0x01)); 755b8e80941Smrg 756b8e80941Smrg /* IF CONDITION */ 757b8e80941Smrg ir_expression *const r009F = equal(swizzle_y(r0097), body.constant(0u)); 758b8e80941Smrg ir_expression *const r00A0 = gequal(swizzle_y(r0096), swizzle_x(r0097)); 759b8e80941Smrg ir_expression *const r00A1 = logic_and(r009F, r00A0); 760b8e80941Smrg ir_if *f009E = new(mem_ctx) ir_if(operand(r00A1).val); 761b8e80941Smrg exec_list *const f009E_parent_instructions = body.instructions; 762b8e80941Smrg 763b8e80941Smrg /* THEN INSTRUCTIONS */ 764b8e80941Smrg body.instructions = &f009E->then_instructions; 765b8e80941Smrg 766b8e80941Smrg ir_variable *const r00A2 = new(mem_ctx) ir_variable(glsl_type::int_type, "i", ir_var_auto); 767b8e80941Smrg body.emit(r00A2); 768b8e80941Smrg ir_variable *const r00A3 = body.make_temp(glsl_type::int_type, "findMSB_retval"); 769b8e80941Smrg body.emit(assign(r00A3, expr(ir_unop_find_msb, swizzle_x(r0097)), 0x01)); 770b8e80941Smrg 771b8e80941Smrg body.emit(assign(r009B, r00A3, 0x01)); 772b8e80941Smrg 773b8e80941Smrg body.emit(assign(r00A2, body.constant(int(31)), 0x01)); 774b8e80941Smrg 775b8e80941Smrg /* LOOP BEGIN */ 776b8e80941Smrg ir_loop *f00A4 = new(mem_ctx) ir_loop(); 777b8e80941Smrg exec_list *const f00A4_parent_instructions = body.instructions; 778b8e80941Smrg 779b8e80941Smrg body.instructions = &f00A4->body_instructions; 780b8e80941Smrg 781b8e80941Smrg /* IF CONDITION */ 782b8e80941Smrg ir_expression *const r00A6 = less(r00A2, body.constant(int(1))); 783b8e80941Smrg ir_if *f00A5 = new(mem_ctx) ir_if(operand(r00A6).val); 784b8e80941Smrg exec_list *const f00A5_parent_instructions = body.instructions; 785b8e80941Smrg 786b8e80941Smrg /* THEN INSTRUCTIONS */ 787b8e80941Smrg body.instructions = &f00A5->then_instructions; 788b8e80941Smrg 789b8e80941Smrg body.emit(new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_break)); 790b8e80941Smrg 791b8e80941Smrg 792b8e80941Smrg body.instructions = f00A5_parent_instructions; 793b8e80941Smrg body.emit(f00A5); 794b8e80941Smrg 795b8e80941Smrg /* END IF */ 796b8e80941Smrg 797b8e80941Smrg /* IF CONDITION */ 798b8e80941Smrg ir_expression *const r00A8 = sub(body.constant(int(31)), r00A2); 799b8e80941Smrg ir_expression *const r00A9 = lequal(r00A3, r00A8); 800b8e80941Smrg ir_expression *const r00AA = lshift(swizzle_x(r0097), r00A2); 801b8e80941Smrg ir_expression *const r00AB = lequal(r00AA, swizzle_y(r0098)); 802b8e80941Smrg ir_expression *const r00AC = logic_and(r00A9, r00AB); 803b8e80941Smrg ir_if *f00A7 = new(mem_ctx) ir_if(operand(r00AC).val); 804b8e80941Smrg exec_list *const f00A7_parent_instructions = body.instructions; 805b8e80941Smrg 806b8e80941Smrg /* THEN INSTRUCTIONS */ 807b8e80941Smrg body.instructions = &f00A7->then_instructions; 808b8e80941Smrg 809b8e80941Smrg ir_expression *const r00AD = lshift(swizzle_x(r0097), r00A2); 810b8e80941Smrg body.emit(assign(r0098, sub(swizzle_y(r0098), r00AD), 0x02)); 811b8e80941Smrg 812b8e80941Smrg ir_expression *const r00AE = lshift(body.constant(1u), r00A2); 813b8e80941Smrg body.emit(assign(r009C, bit_or(swizzle_y(r009C), r00AE), 0x02)); 814b8e80941Smrg 815b8e80941Smrg 816b8e80941Smrg body.instructions = f00A7_parent_instructions; 817b8e80941Smrg body.emit(f00A7); 818b8e80941Smrg 819b8e80941Smrg /* END IF */ 820b8e80941Smrg 821b8e80941Smrg body.emit(assign(r00A2, add(r00A2, body.constant(int(-1))), 0x01)); 822b8e80941Smrg 823b8e80941Smrg /* LOOP END */ 824b8e80941Smrg 825b8e80941Smrg body.instructions = f00A4_parent_instructions; 826b8e80941Smrg body.emit(f00A4); 827b8e80941Smrg 828b8e80941Smrg /* IF CONDITION */ 829b8e80941Smrg ir_expression *const r00B0 = lequal(swizzle_x(r0097), swizzle_y(r0098)); 830b8e80941Smrg ir_if *f00AF = new(mem_ctx) ir_if(operand(r00B0).val); 831b8e80941Smrg exec_list *const f00AF_parent_instructions = body.instructions; 832b8e80941Smrg 833b8e80941Smrg /* THEN INSTRUCTIONS */ 834b8e80941Smrg body.instructions = &f00AF->then_instructions; 835b8e80941Smrg 836b8e80941Smrg body.emit(assign(r0098, sub(swizzle_y(r0098), swizzle_x(r0097)), 0x02)); 837b8e80941Smrg 838b8e80941Smrg body.emit(assign(r009C, bit_or(swizzle_y(r009C), body.constant(1u)), 0x02)); 839b8e80941Smrg 840b8e80941Smrg 841b8e80941Smrg body.instructions = f00AF_parent_instructions; 842b8e80941Smrg body.emit(f00AF); 843b8e80941Smrg 844b8e80941Smrg /* END IF */ 845b8e80941Smrg 846b8e80941Smrg 847b8e80941Smrg body.instructions = f009E_parent_instructions; 848b8e80941Smrg body.emit(f009E); 849b8e80941Smrg 850b8e80941Smrg /* END IF */ 851b8e80941Smrg 852b8e80941Smrg ir_variable *const r00B1 = body.make_temp(glsl_type::uint64_t_type, "packUint2x32_retval"); 853b8e80941Smrg body.emit(assign(r00B1, expr(ir_unop_pack_uint_2x32, r0097), 0x01)); 854b8e80941Smrg 855b8e80941Smrg body.emit(assign(r009A, expr(ir_unop_pack_uint_2x32, r0098), 0x01)); 856b8e80941Smrg 857b8e80941Smrg body.emit(assign(r0099, body.constant(int(31)), 0x01)); 858b8e80941Smrg 859b8e80941Smrg /* LOOP BEGIN */ 860b8e80941Smrg ir_loop *f00B2 = new(mem_ctx) ir_loop(); 861b8e80941Smrg exec_list *const f00B2_parent_instructions = body.instructions; 862b8e80941Smrg 863b8e80941Smrg body.instructions = &f00B2->body_instructions; 864b8e80941Smrg 865b8e80941Smrg /* IF CONDITION */ 866b8e80941Smrg ir_expression *const r00B4 = less(r0099, body.constant(int(1))); 867b8e80941Smrg ir_if *f00B3 = new(mem_ctx) ir_if(operand(r00B4).val); 868b8e80941Smrg exec_list *const f00B3_parent_instructions = body.instructions; 869b8e80941Smrg 870b8e80941Smrg /* THEN INSTRUCTIONS */ 871b8e80941Smrg body.instructions = &f00B3->then_instructions; 872b8e80941Smrg 873b8e80941Smrg body.emit(new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_break)); 874b8e80941Smrg 875b8e80941Smrg 876b8e80941Smrg body.instructions = f00B3_parent_instructions; 877b8e80941Smrg body.emit(f00B3); 878b8e80941Smrg 879b8e80941Smrg /* END IF */ 880b8e80941Smrg 881b8e80941Smrg /* IF CONDITION */ 882b8e80941Smrg ir_expression *const r00B6 = sub(body.constant(int(63)), r0099); 883b8e80941Smrg ir_expression *const r00B7 = lequal(r009B, r00B6); 884b8e80941Smrg ir_expression *const r00B8 = lshift(r00B1, r0099); 885b8e80941Smrg ir_expression *const r00B9 = lequal(r00B8, r009A); 886b8e80941Smrg ir_expression *const r00BA = logic_and(r00B7, r00B9); 887b8e80941Smrg ir_if *f00B5 = new(mem_ctx) ir_if(operand(r00BA).val); 888b8e80941Smrg exec_list *const f00B5_parent_instructions = body.instructions; 889b8e80941Smrg 890b8e80941Smrg /* THEN INSTRUCTIONS */ 891b8e80941Smrg body.instructions = &f00B5->then_instructions; 892b8e80941Smrg 893b8e80941Smrg ir_expression *const r00BB = lshift(r00B1, r0099); 894b8e80941Smrg body.emit(assign(r009A, sub(r009A, r00BB), 0x01)); 895b8e80941Smrg 896b8e80941Smrg ir_expression *const r00BC = lshift(body.constant(1u), r0099); 897b8e80941Smrg body.emit(assign(r009C, bit_or(swizzle_x(r009C), r00BC), 0x01)); 898b8e80941Smrg 899b8e80941Smrg 900b8e80941Smrg body.instructions = f00B5_parent_instructions; 901b8e80941Smrg body.emit(f00B5); 902b8e80941Smrg 903b8e80941Smrg /* END IF */ 904b8e80941Smrg 905b8e80941Smrg body.emit(assign(r0099, add(r0099, body.constant(int(-1))), 0x01)); 906b8e80941Smrg 907b8e80941Smrg /* LOOP END */ 908b8e80941Smrg 909b8e80941Smrg body.instructions = f00B2_parent_instructions; 910b8e80941Smrg body.emit(f00B2); 911b8e80941Smrg 912b8e80941Smrg /* IF CONDITION */ 913b8e80941Smrg ir_expression *const r00BE = lequal(r00B1, r009A); 914b8e80941Smrg ir_if *f00BD = new(mem_ctx) ir_if(operand(r00BE).val); 915b8e80941Smrg exec_list *const f00BD_parent_instructions = body.instructions; 916b8e80941Smrg 917b8e80941Smrg /* THEN INSTRUCTIONS */ 918b8e80941Smrg body.instructions = &f00BD->then_instructions; 919b8e80941Smrg 920b8e80941Smrg body.emit(assign(r009A, sub(r009A, r00B1), 0x01)); 921b8e80941Smrg 922b8e80941Smrg body.emit(assign(r009C, bit_or(swizzle_x(r009C), body.constant(1u)), 0x01)); 923b8e80941Smrg 924b8e80941Smrg 925b8e80941Smrg body.instructions = f00BD_parent_instructions; 926b8e80941Smrg body.emit(f00BD); 927b8e80941Smrg 928b8e80941Smrg /* END IF */ 929b8e80941Smrg 930b8e80941Smrg ir_variable *const r00BF = body.make_temp(glsl_type::uvec4_type, "vec_ctor"); 931b8e80941Smrg body.emit(assign(r00BF, r009C, 0x03)); 932b8e80941Smrg 933b8e80941Smrg body.emit(assign(r00BF, expr(ir_unop_unpack_uint_2x32, r009A), 0x0c)); 934b8e80941Smrg 935b8e80941Smrg ir_swizzle *const r00C0 = swizzle(r00BF, MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_W, SWIZZLE_X, SWIZZLE_X), 2); 936b8e80941Smrg body.emit(ret(r00C0)); 937b8e80941Smrg 938b8e80941Smrg sig->replace_parameters(&sig_parameters); 939b8e80941Smrg return sig; 940b8e80941Smrg} 941b8e80941Smrgir_function_signature * 942b8e80941Smrgimod64(void *mem_ctx, builtin_available_predicate avail) 943b8e80941Smrg{ 944b8e80941Smrg ir_function_signature *const sig = 945b8e80941Smrg new(mem_ctx) ir_function_signature(glsl_type::ivec2_type, avail); 946b8e80941Smrg ir_factory body(&sig->body, mem_ctx); 947b8e80941Smrg sig->is_defined = true; 948b8e80941Smrg 949b8e80941Smrg exec_list sig_parameters; 950b8e80941Smrg 951b8e80941Smrg ir_variable *const r00C1 = new(mem_ctx) ir_variable(glsl_type::ivec2_type, "_n", ir_var_function_in); 952b8e80941Smrg sig_parameters.push_tail(r00C1); 953b8e80941Smrg ir_variable *const r00C2 = new(mem_ctx) ir_variable(glsl_type::ivec2_type, "_d", ir_var_function_in); 954b8e80941Smrg sig_parameters.push_tail(r00C2); 955b8e80941Smrg ir_variable *const r00C3 = new(mem_ctx) ir_variable(glsl_type::bool_type, "negate", ir_var_auto); 956b8e80941Smrg body.emit(r00C3); 957b8e80941Smrg ir_expression *const r00C4 = less(swizzle_y(r00C1), body.constant(int(0))); 958b8e80941Smrg ir_expression *const r00C5 = less(swizzle_y(r00C2), body.constant(int(0))); 959b8e80941Smrg body.emit(assign(r00C3, nequal(r00C4, r00C5), 0x01)); 960b8e80941Smrg 961b8e80941Smrg ir_variable *const r00C6 = body.make_temp(glsl_type::uvec2_type, "n"); 962b8e80941Smrg ir_expression *const r00C7 = expr(ir_unop_pack_int_2x32, r00C1); 963b8e80941Smrg ir_expression *const r00C8 = expr(ir_unop_abs, r00C7); 964b8e80941Smrg ir_expression *const r00C9 = expr(ir_unop_i642u64, r00C8); 965b8e80941Smrg body.emit(assign(r00C6, expr(ir_unop_unpack_uint_2x32, r00C9), 0x03)); 966b8e80941Smrg 967b8e80941Smrg ir_variable *const r00CA = body.make_temp(glsl_type::uvec2_type, "d"); 968b8e80941Smrg ir_expression *const r00CB = expr(ir_unop_pack_int_2x32, r00C2); 969b8e80941Smrg ir_expression *const r00CC = expr(ir_unop_abs, r00CB); 970b8e80941Smrg ir_expression *const r00CD = expr(ir_unop_i642u64, r00CC); 971b8e80941Smrg body.emit(assign(r00CA, expr(ir_unop_unpack_uint_2x32, r00CD), 0x03)); 972b8e80941Smrg 973b8e80941Smrg ir_variable *const r00CE = new(mem_ctx) ir_variable(glsl_type::int_type, "i", ir_var_auto); 974b8e80941Smrg body.emit(r00CE); 975b8e80941Smrg ir_variable *const r00CF = new(mem_ctx) ir_variable(glsl_type::uint64_t_type, "n64", ir_var_auto); 976b8e80941Smrg body.emit(r00CF); 977b8e80941Smrg ir_variable *const r00D0 = new(mem_ctx) ir_variable(glsl_type::int_type, "log2_denom", ir_var_auto); 978b8e80941Smrg body.emit(r00D0); 979b8e80941Smrg ir_variable *const r00D1 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, "quot", ir_var_auto); 980b8e80941Smrg body.emit(r00D1); 981b8e80941Smrg body.emit(assign(r00D1, ir_constant::zero(mem_ctx, glsl_type::uvec2_type), 0x03)); 982b8e80941Smrg 983b8e80941Smrg ir_expression *const r00D2 = expr(ir_unop_find_msb, swizzle_y(r00CA)); 984b8e80941Smrg body.emit(assign(r00D0, add(r00D2, body.constant(int(32))), 0x01)); 985b8e80941Smrg 986b8e80941Smrg /* IF CONDITION */ 987b8e80941Smrg ir_expression *const r00D4 = equal(swizzle_y(r00CA), body.constant(0u)); 988b8e80941Smrg ir_expression *const r00D5 = gequal(swizzle_y(r00C6), swizzle_x(r00CA)); 989b8e80941Smrg ir_expression *const r00D6 = logic_and(r00D4, r00D5); 990b8e80941Smrg ir_if *f00D3 = new(mem_ctx) ir_if(operand(r00D6).val); 991b8e80941Smrg exec_list *const f00D3_parent_instructions = body.instructions; 992b8e80941Smrg 993b8e80941Smrg /* THEN INSTRUCTIONS */ 994b8e80941Smrg body.instructions = &f00D3->then_instructions; 995b8e80941Smrg 996b8e80941Smrg ir_variable *const r00D7 = new(mem_ctx) ir_variable(glsl_type::int_type, "i", ir_var_auto); 997b8e80941Smrg body.emit(r00D7); 998b8e80941Smrg ir_variable *const r00D8 = body.make_temp(glsl_type::int_type, "findMSB_retval"); 999b8e80941Smrg body.emit(assign(r00D8, expr(ir_unop_find_msb, swizzle_x(r00CA)), 0x01)); 1000b8e80941Smrg 1001b8e80941Smrg body.emit(assign(r00D0, r00D8, 0x01)); 1002b8e80941Smrg 1003b8e80941Smrg body.emit(assign(r00D7, body.constant(int(31)), 0x01)); 1004b8e80941Smrg 1005b8e80941Smrg /* LOOP BEGIN */ 1006b8e80941Smrg ir_loop *f00D9 = new(mem_ctx) ir_loop(); 1007b8e80941Smrg exec_list *const f00D9_parent_instructions = body.instructions; 1008b8e80941Smrg 1009b8e80941Smrg body.instructions = &f00D9->body_instructions; 1010b8e80941Smrg 1011b8e80941Smrg /* IF CONDITION */ 1012b8e80941Smrg ir_expression *const r00DB = less(r00D7, body.constant(int(1))); 1013b8e80941Smrg ir_if *f00DA = new(mem_ctx) ir_if(operand(r00DB).val); 1014b8e80941Smrg exec_list *const f00DA_parent_instructions = body.instructions; 1015b8e80941Smrg 1016b8e80941Smrg /* THEN INSTRUCTIONS */ 1017b8e80941Smrg body.instructions = &f00DA->then_instructions; 1018b8e80941Smrg 1019b8e80941Smrg body.emit(new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_break)); 1020b8e80941Smrg 1021b8e80941Smrg 1022b8e80941Smrg body.instructions = f00DA_parent_instructions; 1023b8e80941Smrg body.emit(f00DA); 1024b8e80941Smrg 1025b8e80941Smrg /* END IF */ 1026b8e80941Smrg 1027b8e80941Smrg /* IF CONDITION */ 1028b8e80941Smrg ir_expression *const r00DD = sub(body.constant(int(31)), r00D7); 1029b8e80941Smrg ir_expression *const r00DE = lequal(r00D8, r00DD); 1030b8e80941Smrg ir_expression *const r00DF = lshift(swizzle_x(r00CA), r00D7); 1031b8e80941Smrg ir_expression *const r00E0 = lequal(r00DF, swizzle_y(r00C6)); 1032b8e80941Smrg ir_expression *const r00E1 = logic_and(r00DE, r00E0); 1033b8e80941Smrg ir_if *f00DC = new(mem_ctx) ir_if(operand(r00E1).val); 1034b8e80941Smrg exec_list *const f00DC_parent_instructions = body.instructions; 1035b8e80941Smrg 1036b8e80941Smrg /* THEN INSTRUCTIONS */ 1037b8e80941Smrg body.instructions = &f00DC->then_instructions; 1038b8e80941Smrg 1039b8e80941Smrg ir_expression *const r00E2 = lshift(swizzle_x(r00CA), r00D7); 1040b8e80941Smrg body.emit(assign(r00C6, sub(swizzle_y(r00C6), r00E2), 0x02)); 1041b8e80941Smrg 1042b8e80941Smrg ir_expression *const r00E3 = lshift(body.constant(1u), r00D7); 1043b8e80941Smrg body.emit(assign(r00D1, bit_or(swizzle_y(r00D1), r00E3), 0x02)); 1044b8e80941Smrg 1045b8e80941Smrg 1046b8e80941Smrg body.instructions = f00DC_parent_instructions; 1047b8e80941Smrg body.emit(f00DC); 1048b8e80941Smrg 1049b8e80941Smrg /* END IF */ 1050b8e80941Smrg 1051b8e80941Smrg body.emit(assign(r00D7, add(r00D7, body.constant(int(-1))), 0x01)); 1052b8e80941Smrg 1053b8e80941Smrg /* LOOP END */ 1054b8e80941Smrg 1055b8e80941Smrg body.instructions = f00D9_parent_instructions; 1056b8e80941Smrg body.emit(f00D9); 1057b8e80941Smrg 1058b8e80941Smrg /* IF CONDITION */ 1059b8e80941Smrg ir_expression *const r00E5 = lequal(swizzle_x(r00CA), swizzle_y(r00C6)); 1060b8e80941Smrg ir_if *f00E4 = new(mem_ctx) ir_if(operand(r00E5).val); 1061b8e80941Smrg exec_list *const f00E4_parent_instructions = body.instructions; 1062b8e80941Smrg 1063b8e80941Smrg /* THEN INSTRUCTIONS */ 1064b8e80941Smrg body.instructions = &f00E4->then_instructions; 1065b8e80941Smrg 1066b8e80941Smrg body.emit(assign(r00C6, sub(swizzle_y(r00C6), swizzle_x(r00CA)), 0x02)); 1067b8e80941Smrg 1068b8e80941Smrg body.emit(assign(r00D1, bit_or(swizzle_y(r00D1), body.constant(1u)), 0x02)); 1069b8e80941Smrg 1070b8e80941Smrg 1071b8e80941Smrg body.instructions = f00E4_parent_instructions; 1072b8e80941Smrg body.emit(f00E4); 1073b8e80941Smrg 1074b8e80941Smrg /* END IF */ 1075b8e80941Smrg 1076b8e80941Smrg 1077b8e80941Smrg body.instructions = f00D3_parent_instructions; 1078b8e80941Smrg body.emit(f00D3); 1079b8e80941Smrg 1080b8e80941Smrg /* END IF */ 1081b8e80941Smrg 1082b8e80941Smrg ir_variable *const r00E6 = body.make_temp(glsl_type::uint64_t_type, "packUint2x32_retval"); 1083b8e80941Smrg body.emit(assign(r00E6, expr(ir_unop_pack_uint_2x32, r00CA), 0x01)); 1084b8e80941Smrg 1085b8e80941Smrg body.emit(assign(r00CF, expr(ir_unop_pack_uint_2x32, r00C6), 0x01)); 1086b8e80941Smrg 1087b8e80941Smrg body.emit(assign(r00CE, body.constant(int(31)), 0x01)); 1088b8e80941Smrg 1089b8e80941Smrg /* LOOP BEGIN */ 1090b8e80941Smrg ir_loop *f00E7 = new(mem_ctx) ir_loop(); 1091b8e80941Smrg exec_list *const f00E7_parent_instructions = body.instructions; 1092b8e80941Smrg 1093b8e80941Smrg body.instructions = &f00E7->body_instructions; 1094b8e80941Smrg 1095b8e80941Smrg /* IF CONDITION */ 1096b8e80941Smrg ir_expression *const r00E9 = less(r00CE, body.constant(int(1))); 1097b8e80941Smrg ir_if *f00E8 = new(mem_ctx) ir_if(operand(r00E9).val); 1098b8e80941Smrg exec_list *const f00E8_parent_instructions = body.instructions; 1099b8e80941Smrg 1100b8e80941Smrg /* THEN INSTRUCTIONS */ 1101b8e80941Smrg body.instructions = &f00E8->then_instructions; 1102b8e80941Smrg 1103b8e80941Smrg body.emit(new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_break)); 1104b8e80941Smrg 1105b8e80941Smrg 1106b8e80941Smrg body.instructions = f00E8_parent_instructions; 1107b8e80941Smrg body.emit(f00E8); 1108b8e80941Smrg 1109b8e80941Smrg /* END IF */ 1110b8e80941Smrg 1111b8e80941Smrg /* IF CONDITION */ 1112b8e80941Smrg ir_expression *const r00EB = sub(body.constant(int(63)), r00CE); 1113b8e80941Smrg ir_expression *const r00EC = lequal(r00D0, r00EB); 1114b8e80941Smrg ir_expression *const r00ED = lshift(r00E6, r00CE); 1115b8e80941Smrg ir_expression *const r00EE = lequal(r00ED, r00CF); 1116b8e80941Smrg ir_expression *const r00EF = logic_and(r00EC, r00EE); 1117b8e80941Smrg ir_if *f00EA = new(mem_ctx) ir_if(operand(r00EF).val); 1118b8e80941Smrg exec_list *const f00EA_parent_instructions = body.instructions; 1119b8e80941Smrg 1120b8e80941Smrg /* THEN INSTRUCTIONS */ 1121b8e80941Smrg body.instructions = &f00EA->then_instructions; 1122b8e80941Smrg 1123b8e80941Smrg ir_expression *const r00F0 = lshift(r00E6, r00CE); 1124b8e80941Smrg body.emit(assign(r00CF, sub(r00CF, r00F0), 0x01)); 1125b8e80941Smrg 1126b8e80941Smrg ir_expression *const r00F1 = lshift(body.constant(1u), r00CE); 1127b8e80941Smrg body.emit(assign(r00D1, bit_or(swizzle_x(r00D1), r00F1), 0x01)); 1128b8e80941Smrg 1129b8e80941Smrg 1130b8e80941Smrg body.instructions = f00EA_parent_instructions; 1131b8e80941Smrg body.emit(f00EA); 1132b8e80941Smrg 1133b8e80941Smrg /* END IF */ 1134b8e80941Smrg 1135b8e80941Smrg body.emit(assign(r00CE, add(r00CE, body.constant(int(-1))), 0x01)); 1136b8e80941Smrg 1137b8e80941Smrg /* LOOP END */ 1138b8e80941Smrg 1139b8e80941Smrg body.instructions = f00E7_parent_instructions; 1140b8e80941Smrg body.emit(f00E7); 1141b8e80941Smrg 1142b8e80941Smrg /* IF CONDITION */ 1143b8e80941Smrg ir_expression *const r00F3 = lequal(r00E6, r00CF); 1144b8e80941Smrg ir_if *f00F2 = new(mem_ctx) ir_if(operand(r00F3).val); 1145b8e80941Smrg exec_list *const f00F2_parent_instructions = body.instructions; 1146b8e80941Smrg 1147b8e80941Smrg /* THEN INSTRUCTIONS */ 1148b8e80941Smrg body.instructions = &f00F2->then_instructions; 1149b8e80941Smrg 1150b8e80941Smrg body.emit(assign(r00CF, sub(r00CF, r00E6), 0x01)); 1151b8e80941Smrg 1152b8e80941Smrg body.emit(assign(r00D1, bit_or(swizzle_x(r00D1), body.constant(1u)), 0x01)); 1153b8e80941Smrg 1154b8e80941Smrg 1155b8e80941Smrg body.instructions = f00F2_parent_instructions; 1156b8e80941Smrg body.emit(f00F2); 1157b8e80941Smrg 1158b8e80941Smrg /* END IF */ 1159b8e80941Smrg 1160b8e80941Smrg ir_variable *const r00F4 = body.make_temp(glsl_type::uvec4_type, "vec_ctor"); 1161b8e80941Smrg body.emit(assign(r00F4, r00D1, 0x03)); 1162b8e80941Smrg 1163b8e80941Smrg body.emit(assign(r00F4, expr(ir_unop_unpack_uint_2x32, r00CF), 0x0c)); 1164b8e80941Smrg 1165b8e80941Smrg ir_variable *const r00F5 = body.make_temp(glsl_type::ivec2_type, "conditional_tmp"); 1166b8e80941Smrg /* IF CONDITION */ 1167b8e80941Smrg ir_if *f00F6 = new(mem_ctx) ir_if(operand(r00C3).val); 1168b8e80941Smrg exec_list *const f00F6_parent_instructions = body.instructions; 1169b8e80941Smrg 1170b8e80941Smrg /* THEN INSTRUCTIONS */ 1171b8e80941Smrg body.instructions = &f00F6->then_instructions; 1172b8e80941Smrg 1173b8e80941Smrg ir_swizzle *const r00F7 = swizzle(r00F4, MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_W, SWIZZLE_X, SWIZZLE_X), 2); 1174b8e80941Smrg ir_expression *const r00F8 = expr(ir_unop_pack_uint_2x32, r00F7); 1175b8e80941Smrg ir_expression *const r00F9 = expr(ir_unop_u642i64, r00F8); 1176b8e80941Smrg ir_expression *const r00FA = neg(r00F9); 1177b8e80941Smrg body.emit(assign(r00F5, expr(ir_unop_unpack_int_2x32, r00FA), 0x03)); 1178b8e80941Smrg 1179b8e80941Smrg 1180b8e80941Smrg /* ELSE INSTRUCTIONS */ 1181b8e80941Smrg body.instructions = &f00F6->else_instructions; 1182b8e80941Smrg 1183b8e80941Smrg ir_swizzle *const r00FB = swizzle(r00F4, MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_W, SWIZZLE_X, SWIZZLE_X), 2); 1184b8e80941Smrg body.emit(assign(r00F5, expr(ir_unop_u2i, r00FB), 0x03)); 1185b8e80941Smrg 1186b8e80941Smrg 1187b8e80941Smrg body.instructions = f00F6_parent_instructions; 1188b8e80941Smrg body.emit(f00F6); 1189b8e80941Smrg 1190b8e80941Smrg /* END IF */ 1191b8e80941Smrg 1192b8e80941Smrg body.emit(ret(r00F5)); 1193b8e80941Smrg 1194b8e80941Smrg sig->replace_parameters(&sig_parameters); 1195b8e80941Smrg return sig; 1196b8e80941Smrg} 1197