From: Andrew Pinski Date: Tue, 23 Dec 2025 21:04:28 +0000 (-0800) Subject: ifcvt: Only allow scalar integral modes for noce_try_cond_zero_arith [PR123276] X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2680785a6d14d7d78550edb8361f3b47eb5c4cb6;p=thirdparty%2Fgcc.git ifcvt: Only allow scalar integral modes for noce_try_cond_zero_arith [PR123276] This is the simple fix for PR 123276 where this code can only handle scalar integral modes. We could in theory handle scalar floating point modes here too but it is not worth the trouble. Pushed as obvious after bootstrap/test on x86_64-linux-gnu. PR rtl-optimization/123276 gcc/ChangeLog: * ifcvt.cc (noce_try_cond_zero_arith): Reject non-scalar integral modes. Signed-off-by: Andrew Pinski --- diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc index d7df8773839..75d959f652c 100644 --- a/gcc/ifcvt.cc +++ b/gcc/ifcvt.cc @@ -3147,6 +3147,13 @@ noce_try_cond_zero_arith (struct noce_if_info *if_info) machine_mode mode = GET_MODE (if_info->x); bool reverse = false; + /* Scalar integral modes are only supported here. + Could support scalar floating point but that + would be only with -ffast-math and might + be worse than a branch. */ + if (!SCALAR_INT_MODE_P (mode)) + return false; + if (!noce_simple_bbs (if_info)) return false;