https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120231
chenglulu <chenglulu at loongson dot cn> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |chenglulu at loongson dot cn
--- Comment #14 from chenglulu <chenglulu at loongson dot cn> ---
Hi:
With the patch, the following testcase generates an incorrect assembly on
LoongArch.
test.c
```
unsigned int step;
double sqrt (double x);
void test1 (double);
void
test ()
{
test1 (0.5 / sqrt (1. + step));
}
```
# cc1 test.c -o test.s -Ofast -fdump-tree-dom3
```
test:
.LFB0 = .
.cfi_startproc
pcalau12i $r12,%pc_hi20(.LC0)
fld.d $f0,$r12,%pc_lo12(.LC0)
b %plt(test1)
```
I found that in the dom3 optimization, the range calculation of _5 is
incorrect.
```
Exporting new global ranges:
============================
Global Exported: _5 = [frange] double [5.0e-1 (0x0.8p+0), 5.0e-1 (0x0.8p+0)]
========= Done =============
void test ()
{
unsigned int step.0_1;
double _2;
double _3;
double _4;
double _5;
<bb 2> [local count: 1073741824]:
step.0_1 = step;
_2 = (double) step.0_1;
_3 = _2 + 1.0e+0;
_4 = .RSQRT (_3);
_5 = _4 * 5.0e-1;
test1 (5.0e-1);
return;
}
```