summaryrefslogtreecommitdiffhomepage
path: root/ir/tv
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2016-04-22 14:24:29 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2016-04-22 14:24:29 +0200
commit87eaee70668b381472183650ec606564717bea42 (patch)
tree18eff8498e5b65c80f615664cc6b3a6babf26099 /ir/tv
parent3324b35019d2f88ffa4cfe0752472b5fe9fff010 (diff)
tv: Add 'tarval_is_minus_null()'.
Diffstat (limited to 'ir/tv')
-rw-r--r--ir/tv/tv.c7
-rw-r--r--ir/tv/tv_t.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/ir/tv/tv.c b/ir/tv/tv.c
index 3dd2183..d227a68 100644
--- a/ir/tv/tv.c
+++ b/ir/tv/tv.c
@@ -522,6 +522,13 @@ int tarval_is_all_one(ir_tarval const *tv)
return tv == get_tarval_mode(tv)->all_one && tv != tarval_bad;
}
+bool tarval_is_minus_null(ir_tarval const *const tv)
+{
+ assert(mode_is_float(get_tarval_mode(tv)));
+ const fp_value *val = (const fp_value*)tv->value;
+ return fc_is_negative(val) && fc_is_zero(val);
+}
+
bool tarval_is_minus_one(ir_tarval const *tv)
{
assert(mode_is_float(get_tarval_mode(tv)));
diff --git a/ir/tv/tv_t.h b/ir/tv/tv_t.h
index f525a4d..673733c 100644
--- a/ir/tv/tv_t.h
+++ b/ir/tv/tv_t.h
@@ -129,6 +129,8 @@ uint64_t get_tarval_uint64(ir_tarval const *tv);
bool tarval_is_uint64(ir_tarval const *tv);
+bool tarval_is_minus_null(ir_tarval const *tv);
+
bool tarval_is_minus_one(ir_tarval const *tv);
ir_tarval *get_tarval_small(ir_mode *mode);