• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple avr-unknown-unknown -emit-llvm -o - %s | FileCheck %s
2 
3 // Check that the parameter types match. This verifies pr43309.
4 // RUN: %clang_cc1 -triple avr-unknown-unknown -Wconversion -verify %s
5 // expected-no-diagnostics
6 
bitrev8(unsigned char data)7 unsigned char bitrev8(unsigned char data) {
8     return __builtin_bitreverse8(data);
9 }
10 
11 // CHECK: define zeroext i8 @bitrev8
12 // CHECK: i8 @llvm.bitreverse.i8(i8
13 
bitrev16(unsigned int data)14 unsigned int bitrev16(unsigned int data) {
15     return __builtin_bitreverse16(data);
16 }
17 
18 // CHECK: define i16 @bitrev16
19 // CHECK: i16 @llvm.bitreverse.i16(i16
20 
bitrev32(unsigned long data)21 unsigned long bitrev32(unsigned long data) {
22     return __builtin_bitreverse32(data);
23 }
24 // CHECK: define i32 @bitrev32
25 // CHECK: i32 @llvm.bitreverse.i32(i32
26 
bitrev64(unsigned long long data)27 unsigned long long bitrev64(unsigned long long data) {
28     return __builtin_bitreverse64(data);
29 }
30 
31 // CHECK: define i64 @bitrev64
32 // CHECK: i64 @llvm.bitreverse.i64(i64
33 
rotleft8(unsigned char x,unsigned char y)34 unsigned char rotleft8(unsigned char x, unsigned char y) {
35     return __builtin_rotateleft8(x, y);
36 }
37 
38 // CHECK: define zeroext i8 @rotleft8
39 // CHECK: i8 @llvm.fshl.i8(i8
40 
rotleft16(unsigned int x,unsigned int y)41 unsigned int rotleft16(unsigned int x, unsigned int y) {
42     return __builtin_rotateleft16(x, y);
43 }
44 
45 // CHECK: define i16 @rotleft16
46 // CHECK: i16 @llvm.fshl.i16(i16
47 
rotleft32(unsigned long x,unsigned long y)48 unsigned long rotleft32(unsigned long x, unsigned long y) {
49     return __builtin_rotateleft32(x, y);
50 }
51 // CHECK: define i32 @rotleft32
52 // CHECK: i32 @llvm.fshl.i32(i32
53 
rotleft64(unsigned long long x,unsigned long long y)54 unsigned long long rotleft64(unsigned long long x, unsigned long long y) {
55     return __builtin_rotateleft64(x, y);
56 }
57 
58 // CHECK: define i64 @rotleft64
59 // CHECK: i64 @llvm.fshl.i64(i64
60 
rotright8(unsigned char x,unsigned char y)61 unsigned char rotright8(unsigned char x, unsigned char y) {
62     return __builtin_rotateright8(x, y);
63 }
64 
65 // CHECK: define zeroext i8 @rotright8
66 // CHECK: i8 @llvm.fshr.i8(i8
67 
rotright16(unsigned int x,unsigned int y)68 unsigned int rotright16(unsigned int x, unsigned int y) {
69     return __builtin_rotateright16(x, y);
70 }
71 
72 // CHECK: define i16 @rotright16
73 // CHECK: i16 @llvm.fshr.i16(i16
74 
rotright32(unsigned long x,unsigned long y)75 unsigned long rotright32(unsigned long x, unsigned long y) {
76     return __builtin_rotateright32(x, y);
77 }
78 // CHECK: define i32 @rotright32
79 // CHECK: i32 @llvm.fshr.i32(i32
80 
rotright64(unsigned long long x,unsigned long long y)81 unsigned long long rotright64(unsigned long long x, unsigned long long y) {
82     return __builtin_rotateright64(x, y);
83 }
84 
85 // CHECK: define i64 @rotright64
86 // CHECK: i64 @llvm.fshr.i64(i64
87 
byteswap16(unsigned int x)88 unsigned int byteswap16(unsigned int x) {
89     return __builtin_bswap16(x);
90 }
91 
92 // CHECK: define i16 @byteswap16
93 // CHECK: i16 @llvm.bswap.i16(i16
94 
byteswap32(unsigned long x)95 unsigned long byteswap32(unsigned long x) {
96     return __builtin_bswap32(x);
97 }
98 // CHECK: define i32 @byteswap32
99 // CHECK: i32 @llvm.bswap.i32(i32
100 
byteswap64(unsigned long long x)101 unsigned long long byteswap64(unsigned long long x) {
102     return __builtin_bswap64(x);
103 }
104 
105 // CHECK: define i64 @byteswap64
106 // CHECK: i64 @llvm.bswap.i64(i64
107