Given no NaNs and no signed zeroes it folds:
(fmul X, (select (fcmp X > 0.0), -1.0, 1.0)) -> (fneg (fabs X))
(fmul X, (select (fcmp X > 0.0), 1.0, -1.0)) -> (fabs X)
Differential D34579
Fold fneg and fabs like multiplications rampitec on Jun 23 2017, 4:06 PM. Authored by
Details Given no NaNs and no signed zeroes it folds: (fmul X, (select (fcmp X > 0.0), -1.0, 1.0)) -> (fneg (fabs X))
Diff Detail
Event Timeline
Comment Actions
Is not correct. It should be: If X was -2.0, (fmul X, (select (fcmp X > 0.0), -1.0, 1.0)) is (fmul -2.0, (select false, -1.0, 1.0) ) =>(fmul -2.0, 1.0 ) => -2.0. Which is different from (fneg -2.0) => 2.0.
Comment Actions LGTM.
Comment Actions Note why don't you I did that for GCC and then optimized: |