• Home
  • Raw
  • Download

Lines Matching refs:bld

44 convert_instr(nir_builder *bld, nir_op op,  in convert_instr()  argument
55 af = nir_i2f32(bld, numer); in convert_instr()
56 bf = nir_i2f32(bld, denom); in convert_instr()
57 af = nir_fabs(bld, af); in convert_instr()
58 bf = nir_fabs(bld, bf); in convert_instr()
59 a = nir_iabs(bld, numer); in convert_instr()
60 b = nir_iabs(bld, denom); in convert_instr()
62 af = nir_u2f32(bld, numer); in convert_instr()
63 bf = nir_u2f32(bld, denom); in convert_instr()
69 bf = nir_frcp(bld, bf); in convert_instr()
70 bf = nir_isub(bld, bf, nir_imm_int(bld, 2)); /* yes, really */ in convert_instr()
71 q = nir_fmul(bld, af, bf); in convert_instr()
74 q = nir_f2i32(bld, q); in convert_instr()
76 q = nir_f2u32(bld, q); in convert_instr()
80 r = nir_imul(bld, q, b); in convert_instr()
81 r = nir_isub(bld, a, r); in convert_instr()
82 r = nir_u2f32(bld, r); in convert_instr()
83 r = nir_fmul(bld, r, bf); in convert_instr()
84 r = nir_f2u32(bld, r); in convert_instr()
87 q = nir_iadd(bld, q, r); in convert_instr()
90 r = nir_imul(bld, q, b); in convert_instr()
91 r = nir_isub(bld, a, r); in convert_instr()
92 rt = nir_uge(bld, r, b); in convert_instr()
95 q = nir_bcsel(bld, rt, nir_isub(bld, r, b), r); in convert_instr()
97 r = nir_b2i32(bld, rt); in convert_instr()
99 q = nir_iadd(bld, q, r); in convert_instr()
102 r = nir_ixor(bld, numer, denom); in convert_instr()
103 r = nir_ilt(bld, r, nir_imm_int(bld, 0)); in convert_instr()
104 b = nir_ineg(bld, q); in convert_instr()
105 q = nir_bcsel(bld, r, b, q); in convert_instr()
108 q = nir_imul(bld, q, denom); in convert_instr()
109 q = nir_isub(bld, numer, q); in convert_instr()
111 q = nir_bcsel(bld, nir_ieq_imm(bld, q, 0), in convert_instr()
112 nir_imm_int(bld, 0), in convert_instr()
113 nir_bcsel(bld, r, nir_iadd(bld, q, denom), q)); in convert_instr()
124 emit_udiv(nir_builder *bld, nir_ssa_def *numer, nir_ssa_def *denom, bool modulo) in emit_udiv() argument
126 nir_ssa_def *rcp = nir_frcp(bld, nir_u2f32(bld, denom)); in emit_udiv()
127 rcp = nir_f2u32(bld, nir_fmul_imm(bld, rcp, 4294966784.0)); in emit_udiv()
130 nir_imul(bld, rcp, nir_ineg(bld, denom)); in emit_udiv()
131 rcp = nir_iadd(bld, rcp, nir_umul_high(bld, rcp, neg_rcp_times_denom)); in emit_udiv()
135 nir_ssa_def *quotient = nir_umul_high(bld, numer, rcp); in emit_udiv()
136 nir_ssa_def *num_s_remainder = nir_imul(bld, quotient, denom); in emit_udiv()
137 nir_ssa_def *remainder = nir_isub(bld, numer, num_s_remainder); in emit_udiv()
140 nir_ssa_def *remainder_ge_den = nir_uge(bld, remainder, denom); in emit_udiv()
142 quotient = nir_bcsel(bld, remainder_ge_den, in emit_udiv()
143 nir_iadd_imm(bld, quotient, 1), quotient); in emit_udiv()
145 remainder = nir_bcsel(bld, remainder_ge_den, in emit_udiv()
146 nir_isub(bld, remainder, denom), remainder); in emit_udiv()
149 remainder_ge_den = nir_uge(bld, remainder, denom); in emit_udiv()
151 return nir_bcsel(bld, remainder_ge_den, nir_isub(bld, remainder, denom), in emit_udiv()
154 return nir_bcsel(bld, remainder_ge_den, nir_iadd_imm(bld, quotient, 1), in emit_udiv()
161 emit_idiv(nir_builder *bld, nir_ssa_def *numer, nir_ssa_def *denom, nir_op op) in emit_idiv() argument
163 nir_ssa_def *lh_sign = nir_ilt(bld, numer, nir_imm_int(bld, 0)); in emit_idiv()
164 nir_ssa_def *rh_sign = nir_ilt(bld, denom, nir_imm_int(bld, 0)); in emit_idiv()
165 lh_sign = nir_bcsel(bld, lh_sign, nir_imm_int(bld, -1), nir_imm_int(bld, 0)); in emit_idiv()
166 rh_sign = nir_bcsel(bld, rh_sign, nir_imm_int(bld, -1), nir_imm_int(bld, 0)); in emit_idiv()
168 nir_ssa_def *lhs = nir_iadd(bld, numer, lh_sign); in emit_idiv()
169 nir_ssa_def *rhs = nir_iadd(bld, denom, rh_sign); in emit_idiv()
170 lhs = nir_ixor(bld, lhs, lh_sign); in emit_idiv()
171 rhs = nir_ixor(bld, rhs, rh_sign); in emit_idiv()
174 nir_ssa_def *d_sign = nir_ixor(bld, lh_sign, rh_sign); in emit_idiv()
175 nir_ssa_def *res = emit_udiv(bld, lhs, rhs, false); in emit_idiv()
176 res = nir_ixor(bld, res, d_sign); in emit_idiv()
177 return nir_isub(bld, res, d_sign); in emit_idiv()
179 nir_ssa_def *res = emit_udiv(bld, lhs, rhs, true); in emit_idiv()
180 res = nir_ixor(bld, res, lh_sign); in emit_idiv()
181 res = nir_isub(bld, res, lh_sign); in emit_idiv()
183 nir_ssa_def *cond = nir_ieq_imm(bld, res, 0); in emit_idiv()
184 cond = nir_ior(bld, nir_ieq(bld, lh_sign, rh_sign), cond); in emit_idiv()
185 res = nir_bcsel(bld, cond, res, nir_iadd(bld, res, denom)); in emit_idiv()
192 convert_instr_precise(nir_builder *bld, nir_op op, in convert_instr_precise() argument
196 return emit_udiv(bld, numer, denom, op == nir_op_umod); in convert_instr_precise()
198 return emit_idiv(bld, numer, denom, op); in convert_instr_precise()