Skip to content

Commit

Permalink
[X86] Convert some tests to opaque pointers (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Apr 5, 2023
1 parent e42f920 commit fa46f1a
Show file tree
Hide file tree
Showing 13 changed files with 658 additions and 681 deletions.
622 changes: 310 additions & 312 deletions llvm/test/CodeGen/X86/atomic-unordered.ll

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions llvm/test/CodeGen/X86/atomic64.ll
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -opaque-pointers=0 < %s -O0 -mtriple=x86_64-- -mcpu=corei7 -verify-machineinstrs | FileCheck %s --check-prefix X64
; RUN: llc -opaque-pointers=0 < %s -O0 -mtriple=i386-- -mcpu=i486 -verify-machineinstrs | FileCheck %s --check-prefix I486
; RUN: llc < %s -O0 -mtriple=x86_64-- -mcpu=corei7 -verify-machineinstrs | FileCheck %s --check-prefix X64
; RUN: llc < %s -O0 -mtriple=i386-- -mcpu=i486 -verify-machineinstrs | FileCheck %s --check-prefix I486

@sc64 = external dso_local global i64
@fsc64 = external dso_local global double
@psc64 = external dso_local global i8*
@psc64 = external dso_local global ptr

define void @atomic_fetch_add64() nounwind {
; X64-LABEL: atomic_fetch_add64:
Expand Down Expand Up @@ -47,10 +47,10 @@ define void @atomic_fetch_add64() nounwind {
; I486-NEXT: addl $16, %esp
; I486-NEXT: retl
entry:
%t1 = atomicrmw add i64* @sc64, i64 1 acquire
%t2 = atomicrmw add i64* @sc64, i64 3 acquire
%t3 = atomicrmw add i64* @sc64, i64 5 acquire
%t4 = atomicrmw add i64* @sc64, i64 %t3 acquire
%t1 = atomicrmw add ptr @sc64, i64 1 acquire
%t2 = atomicrmw add ptr @sc64, i64 3 acquire
%t3 = atomicrmw add ptr @sc64, i64 5 acquire
%t4 = atomicrmw add ptr @sc64, i64 %t3 acquire
ret void
}

Expand Down Expand Up @@ -94,10 +94,10 @@ define void @atomic_fetch_sub64() nounwind {
; I486-NEXT: calll __atomic_fetch_sub_8@PLT
; I486-NEXT: addl $16, %esp
; I486-NEXT: retl
%t1 = atomicrmw sub i64* @sc64, i64 1 acquire
%t2 = atomicrmw sub i64* @sc64, i64 3 acquire
%t3 = atomicrmw sub i64* @sc64, i64 5 acquire
%t4 = atomicrmw sub i64* @sc64, i64 %t3 acquire
%t1 = atomicrmw sub ptr @sc64, i64 1 acquire
%t2 = atomicrmw sub ptr @sc64, i64 3 acquire
%t3 = atomicrmw sub ptr @sc64, i64 5 acquire
%t4 = atomicrmw sub ptr @sc64, i64 %t3 acquire
ret void
}

Expand Down Expand Up @@ -149,9 +149,9 @@ define void @atomic_fetch_and64() nounwind {
; I486-NEXT: calll __atomic_fetch_and_8@PLT
; I486-NEXT: addl $16, %esp
; I486-NEXT: retl
%t1 = atomicrmw and i64* @sc64, i64 3 acquire
%t2 = atomicrmw and i64* @sc64, i64 5 acquire
%t3 = atomicrmw and i64* @sc64, i64 %t2 acquire
%t1 = atomicrmw and ptr @sc64, i64 3 acquire
%t2 = atomicrmw and ptr @sc64, i64 5 acquire
%t3 = atomicrmw and ptr @sc64, i64 %t2 acquire
ret void
}

Expand Down Expand Up @@ -202,9 +202,9 @@ define void @atomic_fetch_or64() nounwind {
; I486-NEXT: calll __atomic_fetch_or_8@PLT
; I486-NEXT: addl $16, %esp
; I486-NEXT: retl
%t1 = atomicrmw or i64* @sc64, i64 3 acquire
%t2 = atomicrmw or i64* @sc64, i64 5 acquire
%t3 = atomicrmw or i64* @sc64, i64 %t2 acquire
%t1 = atomicrmw or ptr @sc64, i64 3 acquire
%t2 = atomicrmw or ptr @sc64, i64 5 acquire
%t3 = atomicrmw or ptr @sc64, i64 %t2 acquire
ret void
}

Expand Down Expand Up @@ -255,9 +255,9 @@ define void @atomic_fetch_xor64() nounwind {
; I486-NEXT: calll __atomic_fetch_xor_8@PLT
; I486-NEXT: addl $16, %esp
; I486-NEXT: retl
%t1 = atomicrmw xor i64* @sc64, i64 3 acquire
%t2 = atomicrmw xor i64* @sc64, i64 5 acquire
%t3 = atomicrmw xor i64* @sc64, i64 %t2 acquire
%t1 = atomicrmw xor ptr @sc64, i64 3 acquire
%t2 = atomicrmw xor ptr @sc64, i64 5 acquire
%t3 = atomicrmw xor ptr @sc64, i64 %t2 acquire
ret void
}

Expand Down Expand Up @@ -296,7 +296,7 @@ define void @atomic_fetch_nand64(i64 %x) nounwind {
; I486-NEXT: calll __atomic_fetch_nand_8@PLT
; I486-NEXT: addl $16, %esp
; I486-NEXT: retl
%t1 = atomicrmw nand i64* @sc64, i64 %x acquire
%t1 = atomicrmw nand ptr @sc64, i64 %x acquire
ret void
}

Expand Down Expand Up @@ -387,7 +387,7 @@ define void @atomic_fetch_max64(i64 %x) nounwind {
; I486-NEXT: popl %esi
; I486-NEXT: popl %ebp
; I486-NEXT: retl
%t1 = atomicrmw max i64* @sc64, i64 %x acquire
%t1 = atomicrmw max ptr @sc64, i64 %x acquire

ret void
}
Expand Down Expand Up @@ -479,7 +479,7 @@ define void @atomic_fetch_min64(i64 %x) nounwind {
; I486-NEXT: popl %esi
; I486-NEXT: popl %ebp
; I486-NEXT: retl
%t1 = atomicrmw min i64* @sc64, i64 %x acquire
%t1 = atomicrmw min ptr @sc64, i64 %x acquire

ret void
}
Expand Down Expand Up @@ -571,7 +571,7 @@ define void @atomic_fetch_umax64(i64 %x) nounwind {
; I486-NEXT: popl %esi
; I486-NEXT: popl %ebp
; I486-NEXT: retl
%t1 = atomicrmw umax i64* @sc64, i64 %x acquire
%t1 = atomicrmw umax ptr @sc64, i64 %x acquire

ret void
}
Expand Down Expand Up @@ -663,7 +663,7 @@ define void @atomic_fetch_umin64(i64 %x) nounwind {
; I486-NEXT: popl %esi
; I486-NEXT: popl %ebp
; I486-NEXT: retl
%t1 = atomicrmw umin i64* @sc64, i64 %x acquire
%t1 = atomicrmw umin ptr @sc64, i64 %x acquire

ret void
}
Expand All @@ -683,10 +683,10 @@ define void @atomic_fetch_cmpxchg64() nounwind {
; I486-NEXT: movl %esp, %ebp
; I486-NEXT: andl $-8, %esp
; I486-NEXT: subl $32, %esp
; I486-NEXT: leal {{[0-9]+}}(%esp), %ecx
; I486-NEXT: movl $0, {{[0-9]+}}(%esp)
; I486-NEXT: movl $0, {{[0-9]+}}(%esp)
; I486-NEXT: movl %esp, %eax
; I486-NEXT: leal {{[0-9]+}}(%esp), %ecx
; I486-NEXT: movl %ecx, 4(%eax)
; I486-NEXT: movl $2, 20(%eax)
; I486-NEXT: movl $2, 16(%eax)
Expand All @@ -697,7 +697,7 @@ define void @atomic_fetch_cmpxchg64() nounwind {
; I486-NEXT: movl %ebp, %esp
; I486-NEXT: popl %ebp
; I486-NEXT: retl
%t1 = cmpxchg i64* @sc64, i64 0, i64 1 acquire acquire
%t1 = cmpxchg ptr @sc64, i64 0, i64 1 acquire acquire
ret void
}

Expand All @@ -720,7 +720,7 @@ define void @atomic_fetch_store64(i64 %x) nounwind {
; I486-NEXT: calll __atomic_store_8@PLT
; I486-NEXT: addl $16, %esp
; I486-NEXT: retl
store atomic i64 %x, i64* @sc64 release, align 8
store atomic i64 %x, ptr @sc64 release, align 8
ret void
}

Expand All @@ -743,7 +743,7 @@ define void @atomic_fetch_swap64(i64 %x) nounwind {
; I486-NEXT: calll __atomic_exchange_8@PLT
; I486-NEXT: addl $16, %esp
; I486-NEXT: retl
%t1 = atomicrmw xchg i64* @sc64, i64 %x acquire
%t1 = atomicrmw xchg ptr @sc64, i64 %x acquire
ret void
}

Expand Down Expand Up @@ -773,11 +773,11 @@ define void @atomic_fetch_swapf64(double %x) nounwind {
; I486-NEXT: movl %ebp, %esp
; I486-NEXT: popl %ebp
; I486-NEXT: retl
%t1 = atomicrmw xchg double* @fsc64, double %x acquire
%t1 = atomicrmw xchg ptr @fsc64, double %x acquire
ret void
}

define void @atomic_fetch_swapptr(i8* %x) nounwind {
define void @atomic_fetch_swapptr(ptr %x) nounwind {
; X64-LABEL: atomic_fetch_swapptr:
; X64: # %bb.0:
; X64-NEXT: xchgq %rdi, psc64(%rip)
Expand All @@ -788,6 +788,6 @@ define void @atomic_fetch_swapptr(i8* %x) nounwind {
; I486-NEXT: movl {{[0-9]+}}(%esp), %eax
; I486-NEXT: xchgl %eax, psc64
; I486-NEXT: retl
%t1 = atomicrmw xchg i8** @psc64, i8* %x acquire
%t1 = atomicrmw xchg ptr @psc64, ptr %x acquire
ret void
}
54 changes: 25 additions & 29 deletions llvm/test/CodeGen/X86/catchpad-lifetime.ll
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
; RUN: llc -opaque-pointers=0 -mtriple=x86_64-windows-msvc < %s | FileCheck %s --check-prefix=X64
; RUN: llc -opaque-pointers=0 -mtriple=i686-windows-msvc < %s | FileCheck %s --check-prefix=X86
; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s --check-prefix=X64
; RUN: llc -mtriple=i686-windows-msvc < %s | FileCheck %s --check-prefix=X86

declare void @throw()

declare i32 @__CxxFrameHandler3(...)

declare void @llvm.trap()

define void @test1() personality i32 (...)* @__CxxFrameHandler3 {
define void @test1() personality ptr @__CxxFrameHandler3 {
entry:
%alloca2 = alloca i8*, align 4
%alloca1 = alloca i8*, align 4
store volatile i8* null, i8** %alloca1
%alloca2 = alloca ptr, align 4
%alloca1 = alloca ptr, align 4
store volatile ptr null, ptr %alloca1
invoke void @throw()
to label %unreachable unwind label %catch.dispatch

Expand All @@ -25,7 +25,7 @@ entry:
; X86: pushl %ebx
; X86: pushl %edi
; X86: pushl %esi
; X86: subl $24, %esp
; X86: subl $20, %esp

; X86: movl $0, -32(%ebp)
; X86: calll _throw
Expand All @@ -34,14 +34,12 @@ catch.dispatch: ; preds = %entry
%cs = catchswitch within none [label %catch.pad] unwind to caller

catch.pad: ; preds = %catch.dispatch
%cp = catchpad within %cs [i8* null, i32 0, i8** %alloca1]
%v = load volatile i8*, i8** %alloca1
store volatile i8* null, i8** %alloca1
%bc1 = bitcast i8** %alloca1 to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %bc1)
%bc2 = bitcast i8** %alloca2 to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %bc2)
store volatile i8* null, i8** %alloca1
%cp = catchpad within %cs [ptr null, i32 0, ptr %alloca1]
%v = load volatile ptr, ptr %alloca1
store volatile ptr null, ptr %alloca1
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %alloca1)
call void @llvm.lifetime.start.p0(i64 4, ptr %alloca2)
store volatile ptr null, ptr %alloca1
call void @llvm.trap()
unreachable

Expand All @@ -60,18 +58,18 @@ unreachable: ; preds = %entry
}

; X64-LABEL: $cppxdata$test1:
; X64: .long 56 # CatchObjOffset
; X64: .long 40 # CatchObjOffset

; -20 is difference between the end of the EH reg node stack object and the
; catch object at EBP -32.
; X86-LABEL: L__ehtable$test1:
; X86: .long -20 # CatchObjOffset

define void @test2() personality i32 (...)* @__CxxFrameHandler3 {
define void @test2() personality ptr @__CxxFrameHandler3 {
entry:
%alloca2 = alloca i8*, align 4
%alloca1 = alloca i8*, align 4
store volatile i8* null, i8** %alloca1
%alloca2 = alloca ptr, align 4
%alloca1 = alloca ptr, align 4
store volatile ptr null, ptr %alloca1
invoke void @throw()
to label %unreachable unwind label %catch.dispatch

Expand All @@ -88,13 +86,11 @@ catch.dispatch: ; preds = %entry
%cs = catchswitch within none [label %catch.pad] unwind to caller

catch.pad: ; preds = %catch.dispatch
%cp = catchpad within %cs [i8* null, i32 0, i8** null]
store volatile i8* null, i8** %alloca1
%bc1 = bitcast i8** %alloca1 to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %bc1)
%bc2 = bitcast i8** %alloca2 to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %bc2)
store volatile i8* null, i8** %alloca1
%cp = catchpad within %cs [ptr null, i32 0, ptr null]
store volatile ptr null, ptr %alloca1
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %alloca1)
call void @llvm.lifetime.start.p0(i64 4, ptr %alloca2)
store volatile ptr null, ptr %alloca1
call void @llvm.trap()
unreachable

Expand Down Expand Up @@ -122,9 +118,9 @@ unreachable: ; preds = %entry


; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #0
declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #0

; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #0
declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #0

attributes #0 = { argmemonly nounwind }
Loading

0 comments on commit fa46f1a

Please sign in to comment.