Skip to content

Commit 72d89b0

Browse files
authored
Merge pull request rust-lang#125 from rust-lang/fix/simd-slice
Implement simd_neg
2 parents 41f20fa + 9c3cce6 commit 72d89b0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/intrinsic/simd.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,26 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(bx: &mut Builder<'a, 'gcc, 'tcx>,
163163
simd_xor: Uint, Int => xor;
164164
}
165165

166+
macro_rules! arith_unary {
167+
($($name: ident: $($($p: ident),* => $call: ident),*;)*) => {
168+
$(if name == sym::$name {
169+
match in_elem.kind() {
170+
$($(ty::$p(_))|* => {
171+
return Ok(bx.$call(args[0].immediate()))
172+
})*
173+
_ => {},
174+
}
175+
require!(false,
176+
"unsupported operation on `{}` with element `{}`",
177+
in_ty,
178+
in_elem)
179+
})*
180+
}
181+
}
182+
183+
arith_unary! {
184+
simd_neg: Int => neg, Float => fneg;
185+
}
186+
166187
unimplemented!("simd {}", name);
167188
}

0 commit comments

Comments
 (0)