]> git.lizzy.rs Git - rust.git/commitdiff
Explain promoted extraction for simd shuffle
authorOliver Schneider <github35764891676564198441@oli-obk.de>
Sun, 22 Jul 2018 10:15:04 +0000 (12:15 +0200)
committerOliver Schneider <github35764891676564198441@oli-obk.de>
Mon, 23 Jul 2018 07:51:30 +0000 (09:51 +0200)
src/librustc_codegen_llvm/mir/block.rs

index 92313d69810a4ef4123dfdff0b2b963c38d69541..dc4b9e0ae99d8f41a83b0fb044d43e891e1aca82 100644 (file)
@@ -507,6 +507,9 @@ fn codegen_terminator(&mut self,
                         // promotes any complex rvalues to constants.
                         if i == 2 && intrinsic.unwrap().starts_with("simd_shuffle") {
                             match *arg {
+                                // The shuffle array argument is usually not an explicit constant,
+                                // but specified directly in the code. This means it gets promoted
+                                // and we can then extract the value by evaluating the promoted.
                                 mir::Operand::Copy(mir::Place::Promoted(box(index, ty))) |
                                 mir::Operand::Move(mir::Place::Promoted(box(index, ty))) => {
                                     let param_env = ty::ParamEnv::reveal_all();