Skip to content

WIP: do not promote rustc_args_required_const #80759

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Jan 6, 2021

This is in preparation of a crater experiment. Cc rust-lang/stdarch#248

Promotion is required for the shuffles since the arguments there are of the form [0, 1, 2, 3], which is not an Operand::Const. So getting rid of this case of promotion requires more work (see the FIXME in the code).

However, first I need to figure out a good place to complain when a rustc_args_required_const argument is not an Operand::Const... any ideas?

r? @oli-obk @bjorn3

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 6, 2021
@bjorn3
Copy link
Member

bjorn3 commented Jan 6, 2021

Is it guaranteed that 1 as call argument results in Operand::Const or does this only happen during the const prop optimization?

@rust-log-analyzer

This comment has been minimized.

@RalfJung
Copy link
Member Author

RalfJung commented Jan 6, 2021

Is it guaranteed that 1 as call argument results in Operand::Const or does this only happen during the const prop optimization?

Hm... I guess in principle there could be a temporary.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling tinyvec v0.3.4
error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:186:17
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
186 | |                 _mm_srli_epi32(self.x, $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
193 |   impl<S4: Copy, NI: Copy> RotateEachWord32 for u32x4_sse2<YesS3, S4, NI> {
194 |       rotr_32!(rotate_each_word_right7, 7);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:187:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
187 | |                 _mm_slli_epi32(self.x, 32 - $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
193 |   impl<S4: Copy, NI: Copy> RotateEachWord32 for u32x4_sse2<YesS3, S4, NI> {
194 |       rotr_32!(rotate_each_word_right7, 7);

   Compiling regex-syntax v0.6.18
error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:186:17
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:186:17
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
186 | |                 _mm_srli_epi32(self.x, $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
200 |       rotr_32!(rotate_each_word_right11, 11);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:187:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
187 | |                 _mm_slli_epi32(self.x, 32 - $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
200 |       rotr_32!(rotate_each_word_right11, 11);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:186:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
186 | |                 _mm_srli_epi32(self.x, $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
201 |       rotr_32!(rotate_each_word_right12, 12);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:187:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
187 | |                 _mm_slli_epi32(self.x, 32 - $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
201 |       rotr_32!(rotate_each_word_right12, 12);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:186:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
186 | |                 _mm_srli_epi32(self.x, $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
207 |       rotr_32!(rotate_each_word_right20, 20);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:187:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
187 | |                 _mm_slli_epi32(self.x, 32 - $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
207 |       rotr_32!(rotate_each_word_right20, 20);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:186:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
186 | |                 _mm_srli_epi32(self.x, $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
213 |       rotr_32!(rotate_each_word_right25, 25);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:187:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
187 | |                 _mm_slli_epi32(self.x, 32 - $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
213 |       rotr_32!(rotate_each_word_right25, 25);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:186:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
186 | |                 _mm_srli_epi32(self.x, $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
216 |       rotr_32!(rotate_each_word_right7, 7);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:187:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
187 | |                 _mm_slli_epi32(self.x, 32 - $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
216 |       rotr_32!(rotate_each_word_right7, 7);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:186:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
186 | |                 _mm_srli_epi32(self.x, $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
217 |       rotr_32!(rotate_each_word_right8, 8);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:187:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
187 | |                 _mm_slli_epi32(self.x, 32 - $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
217 |       rotr_32!(rotate_each_word_right8, 8);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:186:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
186 | |                 _mm_srli_epi32(self.x, $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
218 |       rotr_32!(rotate_each_word_right11, 11);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:187:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
187 | |                 _mm_slli_epi32(self.x, 32 - $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
218 |       rotr_32!(rotate_each_word_right11, 11);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:186:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
186 | |                 _mm_srli_epi32(self.x, $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
219 |       rotr_32!(rotate_each_word_right12, 12);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:187:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
187 | |                 _mm_slli_epi32(self.x, 32 - $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
219 |       rotr_32!(rotate_each_word_right12, 12);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:186:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
186 | |                 _mm_srli_epi32(self.x, $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
224 |       rotr_32!(rotate_each_word_right20, 20);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:187:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
187 | |                 _mm_slli_epi32(self.x, 32 - $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
224 |       rotr_32!(rotate_each_word_right20, 20);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:186:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
186 | |                 _mm_srli_epi32(self.x, $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
225 |       rotr_32!(rotate_each_word_right24, 24);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:187:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
187 | |                 _mm_slli_epi32(self.x, 32 - $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
225 |       rotr_32!(rotate_each_word_right24, 24);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:186:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
186 | |                 _mm_srli_epi32(self.x, $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
226 |       rotr_32!(rotate_each_word_right25, 25);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:187:17
    |
    |
180 | / macro_rules! rotr_32 {
181 | |     ($name:ident, $i:expr) => {
182 | |     #[inline(always)]
183 | |     fn $name(self) -> Self {
...   |
187 | |                 _mm_slli_epi32(self.x, 32 - $i as i32),
...   |
191 | |     };
192 | | }
192 | | }
    | |_- in this expansion of `rotr_32!`
...
226 |       rotr_32!(rotate_each_word_right25, 25);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:248:17
    |
    |
242 | / macro_rules! rotr_64 {
243 | |     ($name:ident, $i:expr) => {
244 | |     #[inline(always)]
245 | |     fn $name(self) -> Self {
...   |
248 | |                 _mm_srli_epi64(self.x, $i as i32),
...   |
253 | |     };
254 | | }
254 | | }
    | |_- in this expansion of `rotr_64!`
255 |   impl<S4: Copy, NI: Copy> RotateEachWord32 for u64x2_sse2<YesS3, S4, NI> {
256 |       rotr_64!(rotate_each_word_right7, 7);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:249:17
    |
    |
242 | / macro_rules! rotr_64 {
243 | |     ($name:ident, $i:expr) => {
244 | |     #[inline(always)]
245 | |     fn $name(self) -> Self {
...   |
249 | |                 _mm_slli_epi64(self.x, 64 - $i as i32),
...   |
253 | |     };
254 | | }
254 | | }
    | |_- in this expansion of `rotr_64!`
255 |   impl<S4: Copy, NI: Copy> RotateEachWord32 for u64x2_sse2<YesS3, S4, NI> {
256 |       rotr_64!(rotate_each_word_right7, 7);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:248:17
    |
    |
242 | / macro_rules! rotr_64 {
243 | |     ($name:ident, $i:expr) => {
244 | |     #[inline(always)]
245 | |     fn $name(self) -> Self {
...   |
248 | |                 _mm_srli_epi64(self.x, $i as i32),
...   |
253 | |     };
254 | | }
254 | | }
    | |_- in this expansion of `rotr_64!`
...
262 |       rotr_64!(rotate_each_word_right11, 11);

error: argument 2 is required to be a constant
   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/ppv-lite86-0.2.8/src/x86_64/sse2.rs:249:17
    |
    |
242 | / macro_rules! rotr_64 {
243 | |     ($name:ident, $i:expr) => {
244 | |     #[inline(always)]
245 | |     fn $name(self) -> Self {
...   |
249 | |                 _mm_slli_epi64(self.x, 64 - $i as i32),
...   |
253 | |     };
254 | | }

@RalfJung
Copy link
Member Author

RalfJung commented Jan 7, 2021

We have plenty of code even in the test suite that passes things like $i as i32 or 32 - $i as i32 (where $i is a macro argument). So, we definitely need promotion for rustc_args_required_const for backwards compatibility.

@RalfJung RalfJung closed this Jan 7, 2021
@RalfJung RalfJung deleted the no-args-promote branch January 15, 2021 14:29
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants