[llvm] r337414 - [DAG] Add testcase.
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 18 11:34:52 PDT 2018
Author: niravd
Date: Wed Jul 18 11:34:52 2018
New Revision: 337414
URL: http://llvm.org/viewvc/llvm-project?rev=337414&view=rev
Log:
[DAG] Add testcase.
Added:
llvm/trunk/test/CodeGen/X86/pr37826.ll
Added: llvm/trunk/test/CodeGen/X86/pr37826.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr37826.ll?rev=337414&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pr37826.ll (added)
+++ llvm/trunk/test/CodeGen/X86/pr37826.ll Wed Jul 18 11:34:52 2018
@@ -0,0 +1,67 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -o - %s -mtriple=x86_64--unknown-linux-gnu | FileCheck %s
+
+; When compiled and run this should print zero.
+
+
+ at c = common local_unnamed_addr global i32 0, align 4
+ at f = common local_unnamed_addr global i32 0, align 4
+ at e = common local_unnamed_addr global i32 0, align 4
+ at .str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
+
+; FIXME The generated code here is incorrect. We should only see a
+; single store to f (a bytes store to f+3).
+define void @k(i32 %l) {
+; CHECK-LABEL: k:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movl {{.*}}(%rip), %eax
+; CHECK-NEXT: movl %eax, %ecx
+; CHECK-NEXT: andl $2097151, %ecx # imm = 0x1FFFFF
+; CHECK-NEXT: xorl {{.*}}(%rip), %ecx
+; CHECK-NEXT: xorl $2097151, %ecx # imm = 0x1FFFFF
+; CHECK-NEXT: andl $-16777216, %eax # imm = 0xFF000000
+; CHECK-NEXT: orl %ecx, %eax
+; CHECK-NEXT: movl %eax, {{.*}}(%rip)
+; CHECK-NEXT: shrl $24, %eax
+; CHECK-NEXT: movb %al, f+{{.*}}(%rip)
+; CHECK-NEXT: retq
+ %load = load i32, i32* @c, align 4
+ %load6 = load i32, i32* @f, align 4
+ %clear7 = and i32 %load6, 16777215
+ store i32 %clear7, i32* @c, align 4
+ %neg = and i32 %load6, 2097151
+ %value = xor i32 %neg, 2097151
+ store i32 %load, i32* @c, align 4
+ %t0 = load i32, i32* @e, align 4
+ %value15 = xor i32 %t0, %value
+ %clear16 = and i32 %load6, -16777216
+ %set17 = or i32 %value15, %clear16
+ store i32 %set17, i32* @f, align 4
+ %clear25 = and i32 %set17, -16777216
+ %set26 = or i32 %clear25, %clear7
+ store i32 %set26, i32* @f, align 4
+ ret void
+}
+
+declare i32 @printf(i8* nocapture readonly, ...)
+
+define i32 @main() {
+; CHECK-LABEL: main:
+; CHECK: # %bb.0:
+; CHECK-NEXT: pushq %rax
+; CHECK-NEXT: .cfi_def_cfa_offset 16
+; CHECK-NEXT: movl $1, %edi
+; CHECK-NEXT: callq k
+; CHECK-NEXT: movl {{.*}}(%rip), %esi
+; CHECK-NEXT: movl $.L.str.1, %edi
+; CHECK-NEXT: xorl %eax, %eax
+; CHECK-NEXT: callq printf
+; CHECK-NEXT: xorl %eax, %eax
+; CHECK-NEXT: popq %rcx
+; CHECK-NEXT: .cfi_def_cfa_offset 8
+; CHECK-NEXT: retq
+ tail call void @k(i32 1)
+ %load = load i32, i32* @f, align 4
+ %call = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %load)
+ ret i32 0
+}
More information about the llvm-commits
mailing list