riscv: Cast to float explicitly when comparing a float to an int.
authorGabe Black <gabeblack@google.com>
Mon, 10 Feb 2020 03:28:21 +0000 (19:28 -0800)
committerGabe Black <gabeblack@google.com>
Mon, 10 Feb 2020 22:31:57 +0000 (22:31 +0000)
clang 11 complains that the int value is not represented exactly
otherwise which breaks the build. With this case the comparison is
still the same, but since it's explicit the compiler doesn't warn about
it.

Change-Id: I1d9ffc77e778517d9c6a985ae7aa6c4f1d5b57a2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25225
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Alec Roelke <alec.roelke@gmail.com>
Maintainer: Alec Roelke <alec.roelke@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/riscv/isa/decoder.isa

index daec4139b67150f817a8e55f8a219206fe8f943b..195fe42800fadcdd71bd296dd3ffcd6bb08dbc2b 100644 (file)
@@ -1426,10 +1426,12 @@ decode QUADRANT default Unknown::unknown() {
                         if (std::isnan(fs1)) {
                             Rd_sd = numeric_limits<int32_t>::max();
                             FFLAGS |= FloatInvalid;
-                        } else if (fs1 >= numeric_limits<int32_t>::max()) {
+                        } else if (fs1 >=
+                                float(numeric_limits<int32_t>::max())) {
                             Rd_sd = numeric_limits<int32_t>::max();
                             FFLAGS |= FloatInvalid;
-                        } else if (fs1 <= numeric_limits<int32_t>::min()) {
+                        } else if (fs1 <=
+                                float(numeric_limits<int32_t>::min())) {
                             Rd_sd = numeric_limits<int32_t>::min();
                             FFLAGS |= FloatInvalid;
                         } else {
@@ -1446,7 +1448,8 @@ decode QUADRANT default Unknown::unknown() {
                         } else if (fs1 < 0.0) {
                             Rd = 0;
                             FFLAGS |= FloatInvalid;
-                        } else if (fs1 > numeric_limits<uint32_t>::max()) {
+                        } else if (fs1 >
+                                float(numeric_limits<uint32_t>::max())) {
                             Rd = numeric_limits<uint64_t>::max();
                             FFLAGS |= FloatInvalid;
                         } else {
@@ -1460,10 +1463,12 @@ decode QUADRANT default Unknown::unknown() {
                         if (std::isnan(fs1)) {
                             Rd_sd = numeric_limits<int64_t>::max();
                             FFLAGS |= FloatInvalid;
-                        } else if (fs1 > numeric_limits<int64_t>::max()) {
+                        } else if (fs1 >
+                                float(numeric_limits<int64_t>::max())) {
                             Rd_sd = numeric_limits<int64_t>::max();
                             FFLAGS |= FloatInvalid;
-                        } else if (fs1 < numeric_limits<int64_t>::min()) {
+                        } else if (fs1 <
+                                float(numeric_limits<int64_t>::min())) {
                             Rd_sd = numeric_limits<int64_t>::min();
                             FFLAGS |= FloatInvalid;
                         } else {
@@ -1480,7 +1485,8 @@ decode QUADRANT default Unknown::unknown() {
                         } else if (fs1 < 0.0) {
                             Rd = 0;
                             FFLAGS |= FloatInvalid;
-                        } else if (fs1 > numeric_limits<uint64_t>::max()) {
+                        } else if (fs1 >
+                                float(numeric_limits<uint64_t>::max())) {
                             Rd = numeric_limits<uint64_t>::max();
                             FFLAGS |= FloatInvalid;
                         } else {
@@ -1493,10 +1499,12 @@ decode QUADRANT default Unknown::unknown() {
                         if (std::isnan(Fs1)) {
                             Rd_sd = numeric_limits<int32_t>::max();
                             FFLAGS |= FloatInvalid;
-                        } else if (Fs1 > numeric_limits<int32_t>::max()) {
+                        } else if (Fs1 >
+                                float(numeric_limits<int32_t>::max())) {
                             Rd_sd = numeric_limits<int32_t>::max();
                             FFLAGS |= FloatInvalid;
-                        } else if (Fs1 < numeric_limits<int32_t>::min()) {
+                        } else if (Fs1 <
+                                float(numeric_limits<int32_t>::min())) {
                             Rd_sd = numeric_limits<int32_t>::min();
                             FFLAGS |= FloatInvalid;
                         } else {
@@ -1510,7 +1518,8 @@ decode QUADRANT default Unknown::unknown() {
                         } else if (Fs1 < 0) {
                             Rd = 0;
                             FFLAGS |= FloatInvalid;
-                        } else if (Fs1 > numeric_limits<uint32_t>::max()) {
+                        } else if (Fs1 >
+                                float(numeric_limits<uint32_t>::max())) {
                             Rd = numeric_limits<uint64_t>::max();
                             FFLAGS |= FloatInvalid;
                         } else {
@@ -1521,10 +1530,12 @@ decode QUADRANT default Unknown::unknown() {
                         if (std::isnan(Fs1)) {
                             Rd_sd = numeric_limits<int64_t>::max();
                             FFLAGS |= FloatInvalid;
-                        } else if (Fs1 > numeric_limits<int64_t>::max()) {
+                        } else if (Fs1 >
+                                float(numeric_limits<int64_t>::max())) {
                             Rd_sd = numeric_limits<int64_t>::max();
                             FFLAGS |= FloatInvalid;
-                        } else if (Fs1 < numeric_limits<int64_t>::min()) {
+                        } else if (Fs1 <
+                                float(numeric_limits<int64_t>::min())) {
                             Rd_sd = numeric_limits<int64_t>::min();
                             FFLAGS |= FloatInvalid;
                         } else {
@@ -1538,7 +1549,8 @@ decode QUADRANT default Unknown::unknown() {
                         } else if (Fs1 < 0) {
                             Rd = 0;
                             FFLAGS |= FloatInvalid;
-                        } else if (Fs1 > numeric_limits<uint64_t>::max()) {
+                        } else if (Fs1 >
+                                float(numeric_limits<uint64_t>::max())) {
                             Rd = numeric_limits<uint64_t>::max();
                             FFLAGS |= FloatInvalid;
                         } else {