-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix PostDec operator * Add test: decrement operator
- Loading branch information
1 parent
fd4194b
commit 423dd17
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// RUN: cgeist %s --function=* -S | FileCheck %s | ||
|
||
int prefix_decrement(int x) | ||
{ | ||
return --x; | ||
} | ||
|
||
int postfix_decrement(int x) | ||
{ | ||
return x--; | ||
} | ||
|
||
// CHECK: func.func @prefix_decrement(%[[arg0:.+]]: i32) -> i32 attributes {llvm.linkage = #llvm.linkage<external>} { | ||
// CHECK-NEXT: %[[c1_i32:.+]] = arith.constant -1 : i32 | ||
// CHECK-NEXT: %[[V0:.+]] = arith.addi %[[arg0]], %[[c1_i32]] : i32 | ||
// CHECK-NEXT: return %[[V0]] : i32 | ||
// CHECK-NEXT: } | ||
|
||
// CHECK: func.func @postfix_decrement(%[[arg0:.+]]: i32) -> i32 attributes {llvm.linkage = #llvm.linkage<external>} { | ||
// CHECK-NEXT: return %[[arg0]] : i32 | ||
// CHECK-NEXT: } |