mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-10 16:55:32 +00:00
tcg: Fix tcg gen for vectorized absolute value
The fallback inline expansion for vectorized absolute value, when the host doesn't support such an insn was flawed. E.g. when a vector of bytes has all elements negative, mask will be 0xffff_ffff_ffff_ffff. Subtracting mask only adds 1 to the low element instead of all elements becase -mask is 1 and not 0x0101_0101_0101_0101. Backports commit e7e8f33fb603c3bfa0479d7d924f2ad676a84317
This commit is contained in:
parent
cefb1666c0
commit
c9dc750058
|
@ -2270,7 +2270,8 @@ static void gen_absv_mask(TCGContext *s, TCGv_i64 d, TCGv_i64 b, unsigned vece)
|
|||
* so we never have carry into the next element.
|
||||
*/
|
||||
tcg_gen_xor_i64(s, d, b, t);
|
||||
tcg_gen_sub_i64(s, d, d, t);
|
||||
tcg_gen_andi_i64(s, t, t, dup_const(vece, 1));
|
||||
tcg_gen_add_i64(s, d, d, t);
|
||||
|
||||
tcg_temp_free_i64(s, t);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue