diff options
| author | Stefan Hajnoczi <stefanha@redhat.com> | 2025-02-10 10:23:03 -0500 |
|---|---|---|
| committer | Stefan Hajnoczi <stefanha@redhat.com> | 2025-02-10 10:23:03 -0500 |
| commit | 9c72ba3af2587d2e2870ea0f92aa20de336a86f2 (patch) | |
| tree | 8c48a7ae252af795fb6b60c61070ec76e0a02199 /tcg/optimize.c | |
| parent | 852712695749c0ad23cca1d9983f225b14371933 (diff) | |
| parent | 476d6e4c9c4965734d6f47ee299ac9f84440a9b3 (diff) | |
| download | focaccia-qemu-9c72ba3af2587d2e2870ea0f92aa20de336a86f2.tar.gz focaccia-qemu-9c72ba3af2587d2e2870ea0f92aa20de336a86f2.zip | |
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
* tcg/optimize: optimize TSTNE using smask and zmask * target/i386: fix exceptions for 0 * Inf + QNaN * rust: cleanups to the configuration and the warnings * rust: add developer docs # -----BEGIN PGP SIGNATURE----- # # iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmep0nsUHHBib256aW5p # QHJlZGhhdC5jb20ACgkQv/vSX3jHroN0aggAo8mKY4c7LGLF+5xGM1W/ZLxaBrMN # 4/LGMV3UJJq+OIEb+e7ThtfyHzcAsYXdO2SIMJ6ffW58ukmwM1SycA8WUjG3JMya # m05dVnI//D/G7iqYgyNlsiTbqazdr3P/Ha0ty10l9K9dL3SjB3Nm3xLD4XnD3tzM # U+0yXrn1ngMZ3Y1knTuWwjoH7JT5QftwGCVZ5aeq0KlSAvWb8M8jupYFunLBcZ0z # LkFSWXbxhw9HRkI+Lp6c2IjIBDEd7267tEfnXf+d29ykVnrdyIWgyYw08/Un72i+ # C5hNEUMiwcD7preTYX5YqDcxSASG1zWNFzEWGhTphMWf1O60f2PIXMWX5g== # =0KKa # -----END PGP SIGNATURE----- # gpg: Signature made Mon 10 Feb 2025 05:18:35 EST # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * tag 'for-upstream' of https://gitlab.com/bonzini/qemu: rust: restrict missing_const_for_fn to qemu_api crate rust: pl011: use default set of lints tcg/optimize: optimize TSTNE using smask and zmask tests/tcg/x86_64/fma: Test some x86 fused-multiply-add cases target/i386: Do not raise Invalid for 0 * Inf + QNaN rust: add clippy configuration file rust: add docs rust: include rust_version in Cargo.toml rust: remove unnecessary Cargo.toml metadata Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tcg/optimize.c')
| -rw-r--r-- | tcg/optimize.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c index 8c6303e3af..bca11cc427 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -766,6 +766,7 @@ static int do_constant_folding_cond1(OptContext *ctx, TCGOp *op, TCGArg dest, TCGArg *p1, TCGArg *p2, TCGArg *pcond) { TCGCond cond; + TempOptInfo *i1; bool swap; int r; @@ -783,19 +784,21 @@ static int do_constant_folding_cond1(OptContext *ctx, TCGOp *op, TCGArg dest, return -1; } + i1 = arg_info(*p1); + /* * TSTNE x,x -> NE x,0 - * TSTNE x,-1 -> NE x,0 + * TSTNE x,i -> NE x,0 if i includes all nonzero bits of x */ - if (args_are_copies(*p1, *p2) || arg_is_const_val(*p2, -1)) { + if (args_are_copies(*p1, *p2) || + (arg_is_const(*p2) && (i1->z_mask & ~arg_info(*p2)->val) == 0)) { *p2 = arg_new_constant(ctx, 0); *pcond = tcg_tst_eqne_cond(cond); return -1; } - /* TSTNE x,sign -> LT x,0 */ - if (arg_is_const_val(*p2, (ctx->type == TCG_TYPE_I32 - ? INT32_MIN : INT64_MIN))) { + /* TSTNE x,i -> LT x,0 if i only includes sign bit copies */ + if (arg_is_const(*p2) && (arg_info(*p2)->val & ~i1->s_mask) == 0) { *p2 = arg_new_constant(ctx, 0); *pcond = tcg_tst_ltge_cond(cond); return -1; |