1; RUN: llc -mtriple=x86_64-unknown-unknown < %s | FileCheck %s 2; RUN: llc -mtriple=x86_64-unknown-unknown -O0 < %s | FileCheck %s 3; RUN: llc -mtriple=i686-unknown-unknown -mattr=+sse2 < %s | FileCheck %s 4; RUN: llc -mtriple=i686-unknown-unknown -mattr=+sse2 -O0 < %s | FileCheck %s 5 6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7;; In functions with 'no_caller_saved_registers' attribute, all registers should 8;; be preserved except for registers used for passing/returning arguments. 9;; The test checks that function "bar" preserves xmm0 register. 10;; It also checks that caller function "foo" does not store registers for callee 11;; "bar". For example, there is no store/load/access to xmm registers. 12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 13 14define i32 @bar(i32 %a0, i32 %a1, i32 %a2, i32 %a3, i32 %a4, i32 %a5, i32 %a6, i32 %a7, i32 %a8) #0 { 15; CHECK-LABEL: bar 16; CHECK: mov{{.*}} %xmm0 17; CHECK: mov{{.*}} {{.*}}, %xmm0 18; CHECK: ret 19 call void asm sideeffect "", "~{xmm0}"() 20 ret i32 1 21} 22 23define x86_intrcc void @foo(ptr byval(i8) nocapture readnone %c) { 24; CHECK-LABEL: foo 25; CHECK-NOT: xmm 26entry: 27 tail call i32 @bar(i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8) #0 28 ret void 29} 30 31; Same as foo, but rely on attribute on @bar decl, not callsite 32define x86_intrcc void @baz(ptr byval(i8) nocapture readnone %c) { 33; CHECK-LABEL: baz 34; CHECK-NOT: xmm 35entry: 36 tail call i32 @bar(i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8) 37 ret void 38} 39 40attributes #0 = { "no_caller_saved_registers" } 41