Files
clang-p2996/llvm/test/CodeGen/X86/unaligned-load.ll
Jeremy Morse e6bf48d110 [X86] Don't request 0x90 nop filling in p2align directives (#110134)
As of rev ea222be0d, LLVMs assembler will actually try to honour the
"fill value" part of p2align directives. X86 printed these as 0x90, which
isn't actually what it wanted: we want multi-byte nops for .text
padding. Compiling via a textual assembly file produces single-byte
nop padding since ea222be0d but the built-in assembler will produce
multi-byte nops. This divergent behaviour is undesirable.

To fix: don't set the byte padding field for x86, which allows the
assembler to pick multi-byte nops. Test that we get the same multi-byte
padding when compiled via textual assembly or directly to object file.
Added same-align-bytes-with-llasm-llobj.ll to that effect, updated
numerous other tests to not contain check-lines for the explicit padding.
2024-10-02 11:14:05 +01:00

118 lines
5.0 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=i386-apple-darwin10.0 -mcpu=core2 -relocation-model=dynamic-no-pic | FileCheck -check-prefix=I386 %s
; RUN: llc < %s -mtriple=x86_64-apple-darwin10.0 -mcpu=core2 -relocation-model=dynamic-no-pic | FileCheck -check-prefix=CORE2 %s
; RUN: llc < %s -mtriple=x86_64-apple-darwin10.0 -mcpu=corei7 -relocation-model=dynamic-no-pic | FileCheck -check-prefix=COREI7 %s
@.str1 = internal constant [31 x i8] c"DHRYSTONE PROGRAM, SOME STRING\00", align 8
@.str3 = internal constant [31 x i8] c"DHRYSTONE PROGRAM, 2'ND STRING\00", align 8
; This can be improved; see PR39952.
define void @func() nounwind ssp {
; I386-LABEL: func:
; I386: ## %bb.0: ## %entry
; I386-NEXT: subl $32, %esp
; I386-NEXT: .p2align 4
; I386-NEXT: LBB0_1: ## %bb
; I386-NEXT: ## =>This Inner Loop Header: Depth=1
; I386-NEXT: movl $4673097, {{[0-9]+}}(%esp) ## imm = 0x474E49
; I386-NEXT: movl $1230132307, {{[0-9]+}}(%esp) ## imm = 0x49525453
; I386-NEXT: movl $541347367, {{[0-9]+}}(%esp) ## imm = 0x20444E27
; I386-NEXT: movl $840969293, {{[0-9]+}}(%esp) ## imm = 0x32202C4D
; I386-NEXT: movl $1095911247, {{[0-9]+}}(%esp) ## imm = 0x4152474F
; I386-NEXT: movl $1380982853, {{[0-9]+}}(%esp) ## imm = 0x52502045
; I386-NEXT: movl $1313821779, {{[0-9]+}}(%esp) ## imm = 0x4E4F5453
; I386-NEXT: movl $1498564676, (%esp) ## imm = 0x59524844
; I386-NEXT: jmp LBB0_1
;
; CORE2-LABEL: func:
; CORE2: ## %bb.0: ## %entry
; CORE2-NEXT: movabsq $20070800167293728, %rax ## imm = 0x474E4952545320
; CORE2-NEXT: movabsq $2325069237881678925, %rcx ## imm = 0x20444E2732202C4D
; CORE2-NEXT: movabsq $4706902966564560965, %rdx ## imm = 0x4152474F52502045
; CORE2-NEXT: movabsq $5642821575076104260, %rsi ## imm = 0x4E4F545359524844
; CORE2-NEXT: .p2align 4
; CORE2-NEXT: LBB0_1: ## %bb
; CORE2-NEXT: ## =>This Inner Loop Header: Depth=1
; CORE2-NEXT: movq %rax, -{{[0-9]+}}(%rsp)
; CORE2-NEXT: movq %rcx, -{{[0-9]+}}(%rsp)
; CORE2-NEXT: movq %rdx, -{{[0-9]+}}(%rsp)
; CORE2-NEXT: movq %rsi, -{{[0-9]+}}(%rsp)
; CORE2-NEXT: jmp LBB0_1
;
; COREI7-LABEL: func:
; COREI7: ## %bb.0: ## %entry
; COREI7-NEXT: movups _.str3+15(%rip), %xmm0
; COREI7-NEXT: movups _.str3(%rip), %xmm1
; COREI7-NEXT: .p2align 4
; COREI7-NEXT: LBB0_1: ## %bb
; COREI7-NEXT: ## =>This Inner Loop Header: Depth=1
; COREI7-NEXT: movups %xmm0, -{{[0-9]+}}(%rsp)
; COREI7-NEXT: movaps %xmm1, -{{[0-9]+}}(%rsp)
; COREI7-NEXT: jmp LBB0_1
entry:
%String2Loc = alloca [31 x i8], align 1
br label %bb
bb: ; preds = %bb, %entry
call void @llvm.memcpy.p0.p0.i64(ptr %String2Loc, ptr @.str3, i64 31, i1 false)
br label %bb
return: ; No predecessors!
ret void
}
define void @func_aligned() nounwind ssp {
; I386-LABEL: func_aligned:
; I386: ## %bb.0: ## %entry
; I386-NEXT: subl $44, %esp
; I386-NEXT: movaps {{.*#+}} xmm0 = [1498564676,1313821779,1380982853,1095911247]
; I386-NEXT: .p2align 4
; I386-NEXT: LBB1_1: ## %bb
; I386-NEXT: ## =>This Inner Loop Header: Depth=1
; I386-NEXT: movaps %xmm0, (%esp)
; I386-NEXT: movl $4673097, {{[0-9]+}}(%esp) ## imm = 0x474E49
; I386-NEXT: movl $1230132307, {{[0-9]+}}(%esp) ## imm = 0x49525453
; I386-NEXT: movl $541347367, {{[0-9]+}}(%esp) ## imm = 0x20444E27
; I386-NEXT: movl $840969293, {{[0-9]+}}(%esp) ## imm = 0x32202C4D
; I386-NEXT: jmp LBB1_1
;
; CORE2-LABEL: func_aligned:
; CORE2: ## %bb.0: ## %entry
; CORE2-NEXT: movabsq $20070800167293728, %rax ## imm = 0x474E4952545320
; CORE2-NEXT: movabsq $2325069237881678925, %rcx ## imm = 0x20444E2732202C4D
; CORE2-NEXT: movabsq $4706902966564560965, %rdx ## imm = 0x4152474F52502045
; CORE2-NEXT: movabsq $5642821575076104260, %rsi ## imm = 0x4E4F545359524844
; CORE2-NEXT: .p2align 4
; CORE2-NEXT: LBB1_1: ## %bb
; CORE2-NEXT: ## =>This Inner Loop Header: Depth=1
; CORE2-NEXT: movq %rax, -{{[0-9]+}}(%rsp)
; CORE2-NEXT: movq %rcx, -{{[0-9]+}}(%rsp)
; CORE2-NEXT: movq %rdx, -{{[0-9]+}}(%rsp)
; CORE2-NEXT: movq %rsi, -{{[0-9]+}}(%rsp)
; CORE2-NEXT: jmp LBB1_1
;
; COREI7-LABEL: func_aligned:
; COREI7: ## %bb.0: ## %entry
; COREI7-NEXT: movups _.str3+15(%rip), %xmm0
; COREI7-NEXT: movups _.str3(%rip), %xmm1
; COREI7-NEXT: .p2align 4
; COREI7-NEXT: LBB1_1: ## %bb
; COREI7-NEXT: ## =>This Inner Loop Header: Depth=1
; COREI7-NEXT: movups %xmm0, -{{[0-9]+}}(%rsp)
; COREI7-NEXT: movaps %xmm1, -{{[0-9]+}}(%rsp)
; COREI7-NEXT: jmp LBB1_1
entry:
%String2Loc = alloca [31 x i8], align 16
br label %bb
bb: ; preds = %bb, %entry
call void @llvm.memcpy.p0.p0.i64(ptr %String2Loc, ptr @.str3, i64 31, i1 false)
br label %bb
return: ; No predecessors!
ret void
}
declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind