[llvm] 12dfcc0 - [DAG] Update test case for Issue #69965
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 26 02:35:08 PDT 2023
Author: Simon Pilgrim
Date: 2023-10-26T10:34:58+01:00
New Revision: 12dfcc02388810e113cca359b2b529c98d02307c
URL: https://github.com/llvm/llvm-project/commit/12dfcc02388810e113cca359b2b529c98d02307c
DIFF: https://github.com/llvm/llvm-project/commit/12dfcc02388810e113cca359b2b529c98d02307c.diff
LOG: [DAG] Update test case for Issue #69965
The previous reduced test case just showed a minor codegen regression, this test now shows the actual miscompilation
Added:
Modified:
llvm/test/CodeGen/X86/pr69965.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/X86/pr69965.ll b/llvm/test/CodeGen/X86/pr69965.ll
index fc805e5097c0b85..47bec4d7b1ab563 100644
--- a/llvm/test/CodeGen/X86/pr69965.ll
+++ b/llvm/test/CodeGen/X86/pr69965.ll
@@ -2,40 +2,50 @@
; RUN: llc < %s -mtriple=i686-- | FileCheck %s --check-prefix=X86
; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s --check-prefix=X64
-define i16 @test(i8 %_in) {
-; X86-LABEL: test:
-; X86: # %bb.0:
-; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
-; X86-NEXT: notb %al
-; X86-NEXT: movl %eax, %ecx
-; X86-NEXT: orb $-128, %cl
-; X86-NEXT: movzbl %cl, %ecx
-; X86-NEXT: shll $8, %ecx
-; X86-NEXT: addb %al, %al
-; X86-NEXT: movzbl %al, %eax
-; X86-NEXT: orl %ecx, %eax
-; X86-NEXT: # kill: def $ax killed $ax killed $eax
+define i64 @PR69965(ptr %input_ptrs, ptr %output_ptrs) {
+; X86-LABEL: PR69965:
+; X86: # %bb.0: # %entry
+; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: movl (%eax), %eax
+; X86-NEXT: movzbl (%eax), %eax
+; X86-NEXT: notl %eax
+; X86-NEXT: movzbl %al, %edx
+; X86-NEXT: shll $8, %eax
+; X86-NEXT: movl (%ecx), %ecx
+; X86-NEXT: leal (%eax,%edx,2), %eax
+; X86-NEXT: orl $32768, %eax # imm = 0x8000
+; X86-NEXT: movw %ax, (%ecx)
+; X86-NEXT: xorl %eax, %eax
+; X86-NEXT: xorl %edx, %edx
; X86-NEXT: retl
;
-; X64-LABEL: test:
-; X64: # %bb.0:
-; X64-NEXT: notb %dil
-; X64-NEXT: movl %edi, %eax
-; X64-NEXT: orb $-128, %al
+; X64-LABEL: PR69965:
+; X64: # %bb.0: # %entry
+; X64-NEXT: movq (%rdi), %rax
+; X64-NEXT: movzbl (%rax), %eax
+; X64-NEXT: notl %eax
; X64-NEXT: movzbl %al, %ecx
-; X64-NEXT: shll $8, %ecx
-; X64-NEXT: addb %dil, %dil
-; X64-NEXT: movzbl %dil, %eax
-; X64-NEXT: orl %ecx, %eax
-; X64-NEXT: # kill: def $ax killed $ax killed $eax
+; X64-NEXT: # kill: def $eax killed $eax def $rax
+; X64-NEXT: shll $8, %eax
+; X64-NEXT: movq (%rsi), %rdx
+; X64-NEXT: leal (%rax,%rcx,2), %eax
+; X64-NEXT: orl $32768, %eax # imm = 0x8000
+; X64-NEXT: movw %ax, (%rdx)
+; X64-NEXT: xorl %eax, %eax
; X64-NEXT: retq
- %_1 = and i8 %_in, 127
- %_2 = xor i8 %_1, 127
- %_3 = or i8 %_2, -128
- %_4 = zext i8 %_3 to i16
- %_6 = shl nuw i16 %_4, 8
- %_7 = shl nuw i8 %_2, 1
- %_8 = zext i8 %_7 to i16
- %_9 = or i16 %_6, %_8
- ret i16 %_9
+entry:
+ %0 = load ptr, ptr %input_ptrs, align 8
+ %.val.i = load i8, ptr %0, align 1
+ %1 = and i8 %.val.i, 127
+ %2 = xor i8 %1, 127
+ %3 = or i8 %2, -128
+ %4 = zext i8 %3 to i16
+ %5 = load ptr, ptr %output_ptrs, align 8
+ %6 = shl nuw i16 %4, 8
+ %7 = shl nuw i8 %2, 1
+ %8 = zext i8 %7 to i16
+ %9 = or i16 %6, %8
+ store i16 %9, ptr %5, align 2
+ ret i64 0
}
More information about the llvm-commits
mailing list