You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 01e99f2
Browse filesBrowse the repository at this point in the historyBrowse files
Original commit message:
[riscv]Fix unordered FP comparison and emit at the consumer
The lowering for kFloatLessThanOrUnordered and
kFloatLessThanOrEqualOrUnordered incorrectly mapped to (LT, true)
and (LE, true), respectively. Since ComputeBranchInfo can negate a
branch condition after emitting the comparison, complementary
conditions must use the same comparison and invert its predicate.
The incorrect mappings dropped the negation, breaking NaN semantics.
For example, optimized Wasm loops like
`do { x += 1.0; } while (!(x > 0.0));` produced wrong results.
Fix the mappings: kFloatLessThanOrUnordered now uses negated GE,
and kFloatLessThanOrEqualOrUnordered uses negated GT. To prevent
this class of bug, also convert kRiscvCmpS and kRiscvCmpD into
pseudo-instructions like the integer kRiscvCmp. The actual
comparison is now emitted at the single flags consumer (branch,
boolean materialization, or select) through the new EmitFPCompare
helper, using the consumer's final FlagsCondition. This ensures
the predicate and machine condition are resolved consistently.
Generated code remains byte-identical.
Bug: 557938134
Change-Id: I230e181753c5e9c6e7fbea651e551192a76e4005
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8360836
Reviewed-by: Ji Qiu <qiuji@iscas.ac.cn>
Auto-Submit: Yahan Lu (LuYahan) <yahan@iscas.ac.cn>
Commit-Queue: Ji Qiu <qiuji@iscas.ac.cn>
Cr-Commit-Position: refs/heads/main@{#109690}
Refs: v8/v8@8521e2e
Co-authored-by: LuYahan <yahan@iscas.ac.cn>
0 commit comments