about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndy Sadler <andrewsadler122@gmail.com>2023-11-09 19:07:44 -0600
committerAndy Sadler <andrewsadler122@gmail.com>2023-11-28 21:25:42 -0600
commit3a221320eb49bf464fd332c2be244ca3a783d1ac (patch)
treeac3b35acca0239aa5f1449b4e42d1ae3f8754014
parent03e11a214e9b6295bb06a53f849b117e75986cf6 (diff)
downloadrust-3a221320eb49bf464fd332c2be244ca3a783d1ac.tar.gz
rust-3a221320eb49bf464fd332c2be244ca3a783d1ac.zip
fix simd_neg implementation for ints
gcc_not would panic upon encountering a vector type, which is not what
we want here.

Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
-rw-r--r--src/int.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/int.rs b/src/int.rs
index 9b9b3ea4f87..b69e073c4d9 100644
--- a/src/int.rs
+++ b/src/int.rs
@@ -48,7 +48,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
 
     pub fn gcc_neg(&self, a: RValue<'gcc>) -> RValue<'gcc> {
         let a_type = a.get_type();
-        if self.is_native_int_type(a_type) {
+        if self.is_native_int_type(a_type) || a_type.is_vector() {
             self.cx.context.new_unary_op(None, UnaryOp::Minus, a.get_type(), a)
         }
         else {