Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Does select based on undef result in undef? #63

Closed
LebedevRI opened this issue Jun 9, 2019 · 3 comments
Closed

Does select based on undef result in undef? #63

LebedevRI opened this issue Jun 9, 2019 · 3 comments

Comments

@LebedevRI
Copy link
Contributor

LebedevRI commented Jun 9, 2019

Come up in https://reviews.llvm.org/D63060

----------------------------------------
  %sat = usub_sat i8 %a, %b
  %res = add i8 %sat, %b
=>
  %sat = usub_sat i8 %a, %b
  %t0 = icmp ult i8 %a, %b
  %res = select i1 %t0, i8 %b, i8 %a

ERROR: Value mismatch for i8 %res

Example:
i8 %a = undef
i8 %b = #x10 (16)
i8 %sat = undef
i1 %t0 = undef
Source value: undef
Target value: #x02 (2)

So we're selecting based on %t0, which is undef.
The result should be undef, too, right?

CC @nikic.

@LebedevRI
Copy link
Contributor Author

LebedevRI commented Jun 9, 2019

(moved usub_sat side of the question to #65)

@nunoplopes
Copy link
Member

The transformation seems wrong to me, so Alive is correct in complaining. The counterexample is bogus.
Essentially the LHS is not undef. E.g. take a = undef & b = 0x80.

%sat = undef - 0x80 = [0, 0x7F]
%sat + 0x80 = [0x80, 0xFF]

RHS is undef because we get: undef < 0x80 ? 0x80 : undef, which is undef ? 0x80 : undef, which is undef.

@LebedevRI
Copy link
Contributor Author

@nunoplopes thank you!

Stefan-Mada pushed a commit to Stefan-Mada/alive2-armtv that referenced this issue Oct 16, 2024
Temporarily built a bypass mechanism parameter `size` to bypass dependence on instruction size sets in readFromOperand.
Modified createVectorOp to support operands of differing sizes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants