Print "lock \t foo" instead of "lock \n foo".

This gets gas and llc -filetype=obj to agree on the order of prefixes.

For llvm-mc we need to fix the asm parser to know that it makes a difference
on which line the "lock" is in.

Part of pr23594.

llvm-svn: 238232
This commit is contained in:
Rafael Espindola 2015-05-26 18:35:10 +00:00
parent 856e4fb817
commit d0b9369094
12 changed files with 20 additions and 39 deletions

View File

@ -48,7 +48,7 @@ void X86ATTInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
EmitAnyX86InstComments(MI, *CommentStream, getRegisterName);
if (TSFlags & X86II::LOCK)
OS << "\tlock\n";
OS << "\tlock\t";
// Output CALLpcrel32 as "callq" in 64-bit mode.
// In Intel annotation it's always emitted as "call".

View File

@ -37,8 +37,7 @@ lt_init.exit: ; preds = %if.end.i, %if.then.
%4 = call i64 @llvm.readcyclecounter() nounwind ; <i64> [#uses=1]
%5 = sub i64 %4, %2 ; <i64> [#uses=1]
%6 = atomicrmw add i64* getelementptr inbounds ([1216 x i64], [1216 x i64]* @__profiling_callsite_timestamps_live, i32 0, i32 51), i64 %5 monotonic
;CHECK: lock
;CHECK-NEXT: {{xadd|addq}} %rdx, __profiling_callsite_timestamps_live
;CHECK: lock {{xadd|addq}} %rdx, __profiling_callsite_timestamps_live
;CHECK-NEXT: cmpl $0,
;CHECK-NEXT: jne
%cmp = icmp eq i32 %3, 0 ; <i1> [#uses=1]

View File

@ -14,8 +14,7 @@ entry:
; CHECK: addl $1, %ebx
; CHECK: movl %edx, %ecx
; CHECK: adcl $0, %ecx
; CHECK: lock
; CHECK-NEXT: cmpxchg8b ([[REG]])
; CHECK: lock cmpxchg8b ([[REG]])
; CHECK-NEXT: jne
%0 = atomicrmw add i64* %p, i64 1 seq_cst
ret void

View File

@ -16,8 +16,7 @@ define void @foo(i64* %ptr) nounwind inlinehint {
entry:
br label %loop
loop:
; CHECK: lock
; CHECK-NEXT: cmpxchg8b
; CHECK: lock cmpxchg8b
%pair = cmpxchg i64* %ptr, i64 0, i64 1 monotonic monotonic
%r = extractvalue { i64, i1 } %pair, 0
%stored1 = icmp eq i64 %r, 0

View File

@ -13,8 +13,7 @@ entry:
; Make sure the fence comes before the comparison, since it
; clobbers EFLAGS.
; CHECK: lock
; CHECK-NEXT: orl {{.*}}, (%esp)
; CHECK: lock orl {{.*}}, (%esp)
; CHECK-NEXT: testl [[REG:%e[a-z]+]], [[REG]]
if.then: ; preds = %entry

View File

@ -5,8 +5,7 @@
define void @test1(i64* %ptr, i64 %val1) {
; CHECK-LABEL: test1
; CHECK: lock
; CHECK-NEXT: cmpxchg8b
; CHECK: lock cmpxchg8b
; CHECK-NEXT: jne
store atomic i64 %val1, i64* %ptr seq_cst, align 8
ret void
@ -14,8 +13,7 @@ define void @test1(i64* %ptr, i64 %val1) {
define i64 @test2(i64* %ptr) {
; CHECK-LABEL: test2
; CHECK: lock
; CHECK-NEXT: cmpxchg8b
; CHECK: lock cmpxchg8b
%val = load atomic i64, i64* %ptr seq_cst, align 8
ret i64 %val
}

View File

@ -11,8 +11,7 @@ define void @atomic_maxmin_i6432() {
; LINUX: seta
; LINUX: cmovne
; LINUX: cmovne
; LINUX: lock
; LINUX-NEXT: cmpxchg8b
; LINUX: lock cmpxchg8b
; LINUX: jne [[LABEL]]
%2 = atomicrmw min i64* @sc64, i64 6 acquire
; LINUX: [[LABEL:.LBB[0-9]+_[0-9]+]]
@ -20,8 +19,7 @@ define void @atomic_maxmin_i6432() {
; LINUX: setb
; LINUX: cmovne
; LINUX: cmovne
; LINUX: lock
; LINUX-NEXT: cmpxchg8b
; LINUX: lock cmpxchg8b
; LINUX: jne [[LABEL]]
%3 = atomicrmw umax i64* @sc64, i64 7 acquire
; LINUX: [[LABEL:.LBB[0-9]+_[0-9]+]]
@ -29,8 +27,7 @@ define void @atomic_maxmin_i6432() {
; LINUX: seta
; LINUX: cmovne
; LINUX: cmovne
; LINUX: lock
; LINUX-NEXT: cmpxchg8b
; LINUX: lock cmpxchg8b
; LINUX: jne [[LABEL]]
%4 = atomicrmw umin i64* @sc64, i64 8 acquire
; LINUX: [[LABEL:.LBB[0-9]+_[0-9]+]]
@ -38,8 +35,7 @@ define void @atomic_maxmin_i6432() {
; LINUX: setb
; LINUX: cmovne
; LINUX: cmovne
; LINUX: lock
; LINUX-NEXT: cmpxchg8b
; LINUX: lock cmpxchg8b
; LINUX: jne [[LABEL]]
ret void
}

View File

@ -9,8 +9,7 @@ entry:
%tmp = load i64*, i64** %p.addr, align 8
; CHECK-LABEL: t1:
; CHECK: movl $2147483648, %eax
; CHECK: lock
; CHECK-NEXT: orq %r{{.*}}, (%r{{.*}})
; CHECK: lock orq %r{{.*}}, (%r{{.*}})
%0 = atomicrmw or i64* %tmp, i64 2147483648 seq_cst
ret void
}
@ -21,8 +20,7 @@ entry:
store i64* %p, i64** %p.addr, align 8
%tmp = load i64*, i64** %p.addr, align 8
; CHECK-LABEL: t2:
; CHECK: lock
; CHECK-NEXT: orq $2147483644, (%r{{.*}})
; CHECK: lock orq $2147483644, (%r{{.*}})
%0 = atomicrmw or i64* %tmp, i64 2147483644 seq_cst
ret void
}

View File

@ -4,8 +4,7 @@
define void @t1(i128* nocapture %p) nounwind ssp {
entry:
; CHECK: movl $1, %ebx
; CHECK: lock
; CHECK-NEXT: cmpxchg16b
; CHECK: lock cmpxchg16b
%r = cmpxchg i128* %p, i128 0, i128 1 seq_cst seq_cst
ret void
}

View File

@ -7,8 +7,7 @@
define void @gst_atomic_queue_push(i32* %addr) {
; CHECK-LABEL: gst_atomic_queue_push:
; CHECK: movl (%eax), [[LHS:%e[a-z]+]]
; CHECK: lock
; CHECK-NEXT: orl
; CHECK: lock orl
; CHECK: movl (%eax), [[RHS:%e[a-z]+]]
; CHECK: cmpl [[LHS]], [[RHS]]

View File

@ -2,8 +2,7 @@
define void @pr21099(i64* %p) {
; CHECK-LABEL: pr21099
; CHECK: lock
; CHECK-NEXT: addq $-2147483648
; CHECK: lock addq $-2147483648
; This number is INT32_MIN: 0x80000000UL
%1 = atomicrmw add i64* %p, i64 -2147483648 seq_cst
ret void

View File

@ -7,29 +7,25 @@ define void @atomic_maxmin_i8() {
; CHECK: [[LABEL1:\.?LBB[0-9]+_[0-9]+]]:
; CHECK: movsbl
; CHECK: cmpl
; CHECK: lock
; CHECK-NEXT: cmpxchgb
; CHECK: lock cmpxchgb
; CHECK: jne [[LABEL1]]
%2 = atomicrmw min i8* @sc8, i8 6 acquire
; CHECK: [[LABEL3:\.?LBB[0-9]+_[0-9]+]]:
; CHECK: movsbl
; CHECK: cmpl
; CHECK: lock
; CHECK-NEXT: cmpxchgb
; CHECK: lock cmpxchgb
; CHECK: jne [[LABEL3]]
%3 = atomicrmw umax i8* @sc8, i8 7 acquire
; CHECK: [[LABEL5:\.?LBB[0-9]+_[0-9]+]]:
; CHECK: movzbl
; CHECK: cmpl
; CHECK: lock
; CHECK-NEXT: cmpxchgb
; CHECK: lock cmpxchgb
; CHECK: jne [[LABEL5]]
%4 = atomicrmw umin i8* @sc8, i8 8 acquire
; CHECK: [[LABEL7:\.?LBB[0-9]+_[0-9]+]]:
; CHECK: movzbl
; CHECK: cmpl
; CHECK: lock
; CHECK-NEXT: cmpxchgb
; CHECK: lock cmpxchgb
; CHECK: jne [[LABEL7]]
ret void
}