Raymond Toy pushed to branch issue-336-1-fix-compiler-notes at cmucl / cmucl
Commits: 1cf38921 by Raymond Toy at 2024-07-12T17:19:30-07:00 Fix note about unreachable code in float-sse2.lisp
The warning happens because we do `(and ,commutative ...)` where `commutative` is a known value passed to the macro. When the value is zero, we get the note since the rest of the `and` clause is known to be unreachable.
Change this to handle the `commutative` and macro-expansion time to add the clause only when `commutative` is true.
- - - - -
1 changed file:
- src/compiler/x86/float-sse2.lisp
Changes:
===================================== src/compiler/x86/float-sse2.lisp ===================================== @@ -773,10 +773,11 @@ (inst ,opinst x (,ea y))) (,stack-sc (inst ,opinst x (,ea-stack y))))) - ((and ,commutative (location= y r)) - ;; y = r and the operation is commutative, so just - ;; do the operation with r and x. - (inst ,opinst y x)) + ,@(when commutative + `(((location= y r) + ;; y = r and the operation is commutative, so just + ;; do the operation with r and x. + (inst ,opinst y x)))) ((not (location= r y)) ;; x, y, and r are three different regs. So just ;; move r to x and do the operation on r. @@ -1994,8 +1995,9 @@ `(cond ((location= x r) (inst ,opinst x y)) - ((and ,commutative (location= y r)) - (inst ,opinst y x)) + ,@(when commutative + `(((location= y r) + (inst ,opinst y x)))) ((not (location= r y)) (inst ,movinst r x) (inst ,opinst r y))
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/1cf38921444b05008021ac32...