Chris Lattner | e66b65c | 2008-02-06 01:42:25 +0000 | [diff] [blame] | 1 | // RUN: clang %s -emit-llvm -o - > %t1 |
Lauro Ramos Venancio | 3b8c22d | 2008-01-22 20:17:04 +0000 | [diff] [blame] | 2 | // RUN: grep "shl i32 %tmp, 19" %t1 && |
| 3 | // RUN: grep "ashr i32 %tmp1, 19" %t1 && |
| 4 | // RUN: grep "shl i16 %tmp4, 1" %t1 && |
| 5 | // RUN: grep "lshr i16 %tmp5, 9" %t1 |
Lauro Ramos Venancio | a0c5d0e | 2008-01-22 22:36:45 +0000 | [diff] [blame] | 6 | // RUN: grep "and i32 %tmp, -8192" %t1 |
| 7 | // RUN: grep "and i16 %tmp5, -32513" %t1 |
Lauro Ramos Venancio | d957aa0 | 2008-02-07 19:29:53 +0000 | [diff] [blame^] | 8 | // RUN: grep "getelementptr (i32\* bitcast (.struct.STestB2\* @stb2 to i32\*), i32 1)" %t1 |
Lauro Ramos Venancio | 3b8c22d | 2008-01-22 20:17:04 +0000 | [diff] [blame] | 9 | // Test bitfield access |
| 10 | |
| 11 | |
| 12 | struct STestB1 { int a:13; char b; unsigned short c:7;} stb1; |
Lauro Ramos Venancio | d957aa0 | 2008-02-07 19:29:53 +0000 | [diff] [blame^] | 13 | struct STestB2 { short a[3]; int b:15} stb2; |
Lauro Ramos Venancio | 3b8c22d | 2008-01-22 20:17:04 +0000 | [diff] [blame] | 14 | |
| 15 | int f() { |
| 16 | return stb1.a + stb1.b + stb1.c; |
| 17 | } |
Lauro Ramos Venancio | a0c5d0e | 2008-01-22 22:36:45 +0000 | [diff] [blame] | 18 | |
| 19 | void g() { |
| 20 | stb1.a = -40; |
| 21 | stb1.b = 10; |
| 22 | stb1.c = 15; |
| 23 | } |
Lauro Ramos Venancio | d957aa0 | 2008-02-07 19:29:53 +0000 | [diff] [blame^] | 24 | |
| 25 | int h() { |
| 26 | return stb2.a[1] + stb2.b; |
| 27 | } |
| 28 | |
| 29 | void i(){ |
| 30 | stb2.a[2] = -40; |
| 31 | stb2.b = 10; |
| 32 | } |