|
1 | 1 | // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -Wno-unused-value -emit-cir %s -o %t.cir
|
2 | 2 | // RUN: FileCheck --input-file=%t.cir %s
|
3 | 3 |
|
4 |
| -void valueNegation(int i, short s, long l, float f, double d) { |
5 |
| -// CHECK: cir.func @valueNegation( |
6 |
| - !i; |
| 4 | +int valueNegationInt(int i) { |
| 5 | +// CHECK: cir.func @valueNegationInt( |
| 6 | + return !i; |
7 | 7 | // CHECK: %[[#INT:]] = cir.load %{{[0-9]+}} : !cir.ptr<!s32i>, !s32i
|
8 | 8 | // CHECK: %[[#INT_TO_BOOL:]] = cir.cast(int_to_bool, %[[#INT]] : !s32i), !cir.bool
|
9 | 9 | // CHECK: = cir.unary(not, %[[#INT_TO_BOOL]]) : !cir.bool, !cir.bool
|
10 |
| - !s; |
| 10 | +} |
| 11 | + |
| 12 | +short valueNegationShort(short s) { |
| 13 | +// CHECK: cir.func @valueNegationShort( |
| 14 | + return !s; |
11 | 15 | // CHECK: %[[#SHORT:]] = cir.load %{{[0-9]+}} : !cir.ptr<!s16i>, !s16i
|
12 | 16 | // CHECK: %[[#SHORT_TO_BOOL:]] = cir.cast(int_to_bool, %[[#SHORT]] : !s16i), !cir.bool
|
13 | 17 | // CHECK: = cir.unary(not, %[[#SHORT_TO_BOOL]]) : !cir.bool, !cir.bool
|
14 |
| - !l; |
| 18 | +} |
| 19 | + |
| 20 | +long valueNegationLong(long l) { |
| 21 | +// CHECK: cir.func @valueNegationLong( |
| 22 | + return !l; |
15 | 23 | // CHECK: %[[#LONG:]] = cir.load %{{[0-9]+}} : !cir.ptr<!s64i>, !s64i
|
16 | 24 | // CHECK: %[[#LONG_TO_BOOL:]] = cir.cast(int_to_bool, %[[#LONG]] : !s64i), !cir.bool
|
17 | 25 | // CHECK: = cir.unary(not, %[[#LONG_TO_BOOL]]) : !cir.bool, !cir.bool
|
18 |
| - !f; |
| 26 | +} |
| 27 | + |
| 28 | +float valueNegationFloat(float f) { |
| 29 | +// CHECK: cir.func @valueNegationFloat( |
| 30 | + return !f; |
19 | 31 | // CHECK: %[[#FLOAT:]] = cir.load %{{[0-9]+}} : !cir.ptr<!cir.float>, !cir.float
|
20 | 32 | // CHECK: %[[#FLOAT_TO_BOOL:]] = cir.cast(float_to_bool, %[[#FLOAT]] : !cir.float), !cir.bool
|
21 | 33 | // CHECK: %[[#FLOAT_NOT:]] = cir.unary(not, %[[#FLOAT_TO_BOOL]]) : !cir.bool, !cir.bool
|
22 | 34 | // CHECK: = cir.cast(bool_to_int, %[[#FLOAT_NOT]] : !cir.bool), !s32i
|
23 |
| - !d; |
| 35 | +} |
| 36 | + |
| 37 | +double valueNegationDouble(double d) { |
| 38 | +// CHECK: cir.func @valueNegationDouble( |
| 39 | + return !d; |
24 | 40 | // CHECK: %[[#DOUBLE:]] = cir.load %{{[0-9]+}} : !cir.ptr<!cir.double>, !cir.double
|
25 | 41 | // CHECK: %[[#DOUBLE_TO_BOOL:]] = cir.cast(float_to_bool, %[[#DOUBLE]] : !cir.double), !cir.bool
|
26 | 42 | // CHECK: %[[#DOUBLE_NOT:]] = cir.unary(not, %[[#DOUBLE_TO_BOOL]]) : !cir.bool, !cir.bool
|
|
0 commit comments