xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/nvptx-inlineasm-ptx.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple nvptx-unknown-unknown -O3 -S -o - %s -emit-llvm | FileCheck %s
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple nvptx64-unknown-unknown -O3 -S -o - %s -emit-llvm | FileCheck %s
3*f4a2713aSLionel Sambuc 
constraints()4*f4a2713aSLionel Sambuc void constraints() {
5*f4a2713aSLionel Sambuc   char           c;
6*f4a2713aSLionel Sambuc   unsigned char  uc;
7*f4a2713aSLionel Sambuc   short          s;
8*f4a2713aSLionel Sambuc   unsigned short us;
9*f4a2713aSLionel Sambuc   int            i;
10*f4a2713aSLionel Sambuc   unsigned int   ui;
11*f4a2713aSLionel Sambuc   long           l;
12*f4a2713aSLionel Sambuc   unsigned long  ul;
13*f4a2713aSLionel Sambuc   float          f;
14*f4a2713aSLionel Sambuc   double         d;
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc   // CHECK: i8 asm sideeffect "mov.b8 $0, $1;", "=c,c"
17*f4a2713aSLionel Sambuc   asm volatile ("mov.b8 %0, %1;" : "=c"(c) : "c"(c));
18*f4a2713aSLionel Sambuc   // CHECK: i8 asm sideeffect "mov.b8 $0, $1;", "=c,c"
19*f4a2713aSLionel Sambuc   asm volatile ("mov.b8 %0, %1;" : "=c"(uc) : "c"(uc));
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc   // CHECK: i16 asm sideeffect "mov.b16 $0, $1;", "=h,h"
22*f4a2713aSLionel Sambuc   asm volatile ("mov.b16 %0, %1;" : "=h"(s) : "h"(s));
23*f4a2713aSLionel Sambuc   // CHECK: i16 asm sideeffect "mov.b16 $0, $1;", "=h,h"
24*f4a2713aSLionel Sambuc   asm volatile ("mov.b16 %0, %1;" : "=h"(us) : "h"(us));
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc   // CHECK: i32 asm sideeffect "mov.b32 $0, $1;", "=r,r"
27*f4a2713aSLionel Sambuc   asm volatile ("mov.b32 %0, %1;" : "=r"(i) : "r"(i));
28*f4a2713aSLionel Sambuc   // CHECK: i32 asm sideeffect "mov.b32 $0, $1;", "=r,r"
29*f4a2713aSLionel Sambuc   asm volatile ("mov.b32 %0, %1;" : "=r"(ui) : "r"(ui));
30*f4a2713aSLionel Sambuc 
31*f4a2713aSLionel Sambuc   // CHECK: i64 asm sideeffect "mov.b64 $0, $1;", "=l,l"
32*f4a2713aSLionel Sambuc   asm volatile ("mov.b64 %0, %1;" : "=l"(l) : "l"(l));
33*f4a2713aSLionel Sambuc   // CHECK: i64 asm sideeffect "mov.b64 $0, $1;", "=l,l"
34*f4a2713aSLionel Sambuc   asm volatile ("mov.b64 %0, %1;" : "=l"(ul) : "l"(ul));
35*f4a2713aSLionel Sambuc 
36*f4a2713aSLionel Sambuc   // CHECK: float asm sideeffect "mov.b32 $0, $1;", "=f,f"
37*f4a2713aSLionel Sambuc   asm volatile ("mov.b32 %0, %1;" : "=f"(f) : "f"(f));
38*f4a2713aSLionel Sambuc   // CHECK: double asm sideeffect "mov.b64 $0, $1;", "=d,d"
39*f4a2713aSLionel Sambuc   asm volatile ("mov.b64 %0, %1;" : "=d"(d) : "d"(d));
40*f4a2713aSLionel Sambuc }
41