comparison clang/test/CodeGen/renderscript.c @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 79ff65ed7e25
children
comparison
equal deleted inserted replaced
232:70dce7da266c 236:c4bab56944e8
15 #endif 15 #endif
16 16
17 _Static_assert(sizeof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong"); 17 _Static_assert(sizeof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong");
18 _Static_assert(_Alignof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong"); 18 _Static_assert(_Alignof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong");
19 19
20 // CHECK-RS32: i64 @test_long(i64 %v) 20 // CHECK-RS32: i64 @test_long(i64 noundef %v)
21 // CHECK-RS64: i64 @test_long(i64 %v) 21 // CHECK-RS64: i64 @test_long(i64 noundef %v)
22 // CHECK-ARM: i32 @test_long(i32 %v) 22 // CHECK-ARM: i32 @test_long(i32 noundef %v)
23 long test_long(long v) { 23 long test_long(long v) {
24 return v + 1; 24 return v + 1;
25 } 25 }
26 26
27 // ============================================================================= 27 // =============================================================================
49 // 64-bit RenderScript 49 // 64-bit RenderScript
50 // ============================================================================= 50 // =============================================================================
51 51
52 // CHECK-RS32: [3 x i8] @retChar3() 52 // CHECK-RS32: [3 x i8] @retChar3()
53 // CHECK-RS64: [3 x i8] @retChar3() 53 // CHECK-RS64: [3 x i8] @retChar3()
54 sChar3 retChar3() { sChar3 r; return r; } 54 sChar3 retChar3(void) { sChar3 r; return r; }
55 55
56 // CHECK-RS32: [2 x i16] @retShortChar() 56 // CHECK-RS32: [2 x i16] @retShortChar()
57 // CHECK-RS64: [2 x i16] @retShortChar() 57 // CHECK-RS64: [2 x i16] @retShortChar()
58 sShortChar retShortChar() { sShortChar r; return r; } 58 sShortChar retShortChar(void) { sShortChar r; return r; }
59 59
60 // ============================================================================= 60 // =============================================================================
61 // aggregate parameter <= 16 bytes: coerced to [a x iNN] for both 32-bit and 61 // aggregate parameter <= 16 bytes: coerced to [a x iNN] for both 32-bit and
62 // 64-bit RenderScript 62 // 64-bit RenderScript
63 // ============================================================================= 63 // =============================================================================
81 // ============================================================================= 81 // =============================================================================
82 // aggregate return value <= 16 bytes: returned on stack for 32-bit RenderScript 82 // aggregate return value <= 16 bytes: returned on stack for 32-bit RenderScript
83 // and coerced to [a x iNN] for 64-bit RenderScript 83 // and coerced to [a x iNN] for 64-bit RenderScript
84 // ============================================================================= 84 // =============================================================================
85 85
86 // CHECK-RS32: void @retShortCharShort(%struct.sShortCharShort* noalias sret(%struct.sShortCharShort) align 2 %agg.result) 86 // CHECK-RS32: void @retShortCharShort(ptr noalias sret(%struct.sShortCharShort) align 2 %agg.result)
87 // CHECK-RS64: [3 x i16] @retShortCharShort() 87 // CHECK-RS64: [3 x i16] @retShortCharShort()
88 sShortCharShort retShortCharShort() { sShortCharShort r; return r; } 88 sShortCharShort retShortCharShort(void) { sShortCharShort r; return r; }
89 89
90 // CHECK-RS32: void @retIntShortChar(%struct.sIntShortChar* noalias sret(%struct.sIntShortChar) align 4 %agg.result) 90 // CHECK-RS32: void @retIntShortChar(ptr noalias sret(%struct.sIntShortChar) align 4 %agg.result)
91 // CHECK-RS64: [2 x i32] @retIntShortChar() 91 // CHECK-RS64: [2 x i32] @retIntShortChar()
92 sIntShortChar retIntShortChar() { sIntShortChar r; return r; } 92 sIntShortChar retIntShortChar(void) { sIntShortChar r; return r; }
93 93
94 // CHECK-RS32: void @retLongInt(%struct.sLongInt* noalias sret(%struct.sLongInt) align 8 %agg.result) 94 // CHECK-RS32: void @retLongInt(ptr noalias sret(%struct.sLongInt) align 8 %agg.result)
95 // CHECK-RS64: [2 x i64] @retLongInt() 95 // CHECK-RS64: [2 x i64] @retLongInt()
96 sLongInt retLongInt() { sLongInt r; return r; } 96 sLongInt retLongInt(void) { sLongInt r; return r; }
97 97
98 // ============================================================================= 98 // =============================================================================
99 // aggregate parameter <= 64 bytes: coerced to [a x iNN] for 32-bit RenderScript 99 // aggregate parameter <= 64 bytes: coerced to [a x iNN] for 32-bit RenderScript
100 // and passed on the stack for 64-bit RenderScript 100 // and passed on the stack for 64-bit RenderScript
101 // ============================================================================= 101 // =============================================================================
102 102
103 typedef struct {int i1, i2, i3, i4, i5; } sInt5; 103 typedef struct {int i1, i2, i3, i4, i5; } sInt5;
104 typedef struct {long l1, l2; char c; } sLong2Char; 104 typedef struct {long l1, l2; char c; } sLong2Char;
105 105
106 // CHECK-RS32: void @argInt5([5 x i32] %s.coerce) 106 // CHECK-RS32: void @argInt5([5 x i32] %s.coerce)
107 // CHECK-RS64: void @argInt5(%struct.sInt5* %s) 107 // CHECK-RS64: void @argInt5(ptr noundef %s)
108 void argInt5(sInt5 s) {} 108 void argInt5(sInt5 s) {}
109 109
110 // CHECK-RS32: void @argLong2Char([3 x i64] %s.coerce) 110 // CHECK-RS32: void @argLong2Char([3 x i64] %s.coerce)
111 // CHECK-RS64: void @argLong2Char(%struct.sLong2Char* %s) 111 // CHECK-RS64: void @argLong2Char(ptr noundef %s)
112 void argLong2Char(sLong2Char s) {} 112 void argLong2Char(sLong2Char s) {}
113 113
114 // ============================================================================= 114 // =============================================================================
115 // aggregate return value <= 64 bytes: returned on stack for both 32-bit and 115 // aggregate return value <= 64 bytes: returned on stack for both 32-bit and
116 // 64-bit RenderScript 116 // 64-bit RenderScript
117 // ============================================================================= 117 // =============================================================================
118 118
119 // CHECK-RS32: void @retInt5(%struct.sInt5* noalias sret(%struct.sInt5) align 4 %agg.result) 119 // CHECK-RS32: void @retInt5(ptr noalias sret(%struct.sInt5) align 4 %agg.result)
120 // CHECK-RS64: void @retInt5(%struct.sInt5* noalias sret(%struct.sInt5) align 4 %agg.result) 120 // CHECK-RS64: void @retInt5(ptr noalias sret(%struct.sInt5) align 4 %agg.result)
121 sInt5 retInt5() { sInt5 r; return r;} 121 sInt5 retInt5(void) { sInt5 r; return r;}
122 122
123 // CHECK-RS32: void @retLong2Char(%struct.sLong2Char* noalias sret(%struct.sLong2Char) align 8 %agg.result) 123 // CHECK-RS32: void @retLong2Char(ptr noalias sret(%struct.sLong2Char) align 8 %agg.result)
124 // CHECK-RS64: void @retLong2Char(%struct.sLong2Char* noalias sret(%struct.sLong2Char) align 8 %agg.result) 124 // CHECK-RS64: void @retLong2Char(ptr noalias sret(%struct.sLong2Char) align 8 %agg.result)
125 sLong2Char retLong2Char() { sLong2Char r; return r;} 125 sLong2Char retLong2Char(void) { sLong2Char r; return r;}
126 126
127 // ============================================================================= 127 // =============================================================================
128 // aggregate parameters and return values > 64 bytes: passed and returned on the 128 // aggregate parameters and return values > 64 bytes: passed and returned on the
129 // stack for both 32-bit and 64-bit RenderScript 129 // stack for both 32-bit and 64-bit RenderScript
130 // ============================================================================= 130 // =============================================================================
131 131
132 typedef struct {long l1, l2, l3, l4, l5, l6, l7, l8, l9; } sLong9; 132 typedef struct {long l1, l2, l3, l4, l5, l6, l7, l8, l9; } sLong9;
133 133
134 // CHECK-RS32: void @argLong9(%struct.sLong9* byval(%struct.sLong9) align 8 %s) 134 // CHECK-RS32: void @argLong9(ptr noundef byval(%struct.sLong9) align 8 %s)
135 // CHECK-RS64: void @argLong9(%struct.sLong9* %s) 135 // CHECK-RS64: void @argLong9(ptr noundef %s)
136 void argLong9(sLong9 s) {} 136 void argLong9(sLong9 s) {}
137 137
138 // CHECK-RS32: void @retLong9(%struct.sLong9* noalias sret(%struct.sLong9) align 8 %agg.result) 138 // CHECK-RS32: void @retLong9(ptr noalias sret(%struct.sLong9) align 8 %agg.result)
139 // CHECK-RS64: void @retLong9(%struct.sLong9* noalias sret(%struct.sLong9) align 8 %agg.result) 139 // CHECK-RS64: void @retLong9(ptr noalias sret(%struct.sLong9) align 8 %agg.result)
140 sLong9 retLong9() { sLong9 r; return r; } 140 sLong9 retLong9(void) { sLong9 r; return r; }