xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/asm_arm.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // REQUIRES: arm-registered-target
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple armv6-unknown-unknown -emit-llvm -o - %s | FileCheck %s
3*f4a2713aSLionel Sambuc 
test0(void)4*f4a2713aSLionel Sambuc void test0(void) {
5*f4a2713aSLionel Sambuc 	asm volatile("mov r0, r0" :: );
6*f4a2713aSLionel Sambuc }
test1(void)7*f4a2713aSLionel Sambuc void test1(void) {
8*f4a2713aSLionel Sambuc 	asm volatile("mov r0, r0" :::
9*f4a2713aSLionel Sambuc 				 "cc", "memory" );
10*f4a2713aSLionel Sambuc }
test2(void)11*f4a2713aSLionel Sambuc void test2(void) {
12*f4a2713aSLionel Sambuc 	asm volatile("mov r0, r0" :::
13*f4a2713aSLionel Sambuc 				 "r0", "r1", "r2", "r3");
14*f4a2713aSLionel Sambuc 	asm volatile("mov r0, r0" :::
15*f4a2713aSLionel Sambuc 				 "r4", "r5", "r6", "r8");
16*f4a2713aSLionel Sambuc }
test3(void)17*f4a2713aSLionel Sambuc void test3(void) {
18*f4a2713aSLionel Sambuc 	asm volatile("mov r0, r0" :::
19*f4a2713aSLionel Sambuc 				 "a1", "a2", "a3", "a4");
20*f4a2713aSLionel Sambuc 	asm volatile("mov r0, r0" :::
21*f4a2713aSLionel Sambuc 				 "v1", "v2", "v3", "v5");
22*f4a2713aSLionel Sambuc }
23*f4a2713aSLionel Sambuc 
24*f4a2713aSLionel Sambuc 
25*f4a2713aSLionel Sambuc // {} should not be treated as asm variants.
test4(float * a,float * b)26*f4a2713aSLionel Sambuc void test4(float *a, float *b) {
27*f4a2713aSLionel Sambuc   // CHECK: @test4
28*f4a2713aSLionel Sambuc   // CHECK: call void asm sideeffect "vld1.32 {d8[],d9[]},
29*f4a2713aSLionel Sambuc   __asm__ volatile (
30*f4a2713aSLionel Sambuc                     "vld1.32 {d8[],d9[]}, [%1,:32] \n\t"
31*f4a2713aSLionel Sambuc                     "vst1.32 {q4},        [%0,:128] \n\t"
32*f4a2713aSLionel Sambuc                     :: "r"(a), "r"(b));
33*f4a2713aSLionel Sambuc }
34*f4a2713aSLionel Sambuc 
35*f4a2713aSLionel Sambuc // {sp, lr, pc} are the canonical names for {r13, r14, r15}.
36*f4a2713aSLionel Sambuc //
37*f4a2713aSLionel Sambuc // CHECK: @test5
38*f4a2713aSLionel Sambuc // CHECK: call void asm sideeffect "", "~{sp},~{lr},~{pc},~{sp},~{lr},~{pc}"()
test5()39*f4a2713aSLionel Sambuc void test5() {
40*f4a2713aSLionel Sambuc   __asm__("" : : : "r13", "r14", "r15", "sp", "lr", "pc");
41*f4a2713aSLionel Sambuc }
42*f4a2713aSLionel Sambuc 
43*f4a2713aSLionel Sambuc // CHECK: @test6
44*f4a2713aSLionel Sambuc // CHECK: call void asm sideeffect "", "
45*f4a2713aSLionel Sambuc // CHECK: ~{s0},~{s1},~{s2},~{s3},~{s4},~{s5},~{s6},~{s7},
46*f4a2713aSLionel Sambuc // CHECK: ~{s8},~{s9},~{s10},~{s11},~{s12},~{s13},~{s14},~{s15},
47*f4a2713aSLionel Sambuc // CHECK: ~{s16},~{s17},~{s18},~{s19},~{s20},~{s21},~{s22},~{s23},
48*f4a2713aSLionel Sambuc // CHECK: ~{s24},~{s25},~{s26},~{s27},~{s28},~{s29},~{s30},~{s31}"()
test6()49*f4a2713aSLionel Sambuc void test6() {
50*f4a2713aSLionel Sambuc   __asm__("" : : :
51*f4a2713aSLionel Sambuc           "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
52*f4a2713aSLionel Sambuc           "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15",
53*f4a2713aSLionel Sambuc           "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23",
54*f4a2713aSLionel Sambuc           "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31");
55*f4a2713aSLionel Sambuc }
56