aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/shuffle_fuzz.py
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-08-07 04:49:54 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-08-07 04:49:54 +0000
commitae42d7d0205a3b7a5b6e2d01affd09dbc97ac736 (patch)
tree35c251d0ca9623a231fd0a26bbe9ac3df7120de2 /llvm/utils/shuffle_fuzz.py
parentfcb526020a41684ba22e0ecb5f6d172fc86a12c4 (diff)
downloadllvm-ae42d7d0205a3b7a5b6e2d01affd09dbc97ac736.zip
llvm-ae42d7d0205a3b7a5b6e2d01affd09dbc97ac736.tar.gz
llvm-ae42d7d0205a3b7a5b6e2d01affd09dbc97ac736.tar.bz2
Add an option to the shuffle fuzzer that lets you fuzz exclusively
within a single bit-width of vectors. This is particularly useful for when you know you have bugs in a certain area and want to find simpler test cases than those produced by an open-ended fuzzing that ends up legalizing the vector in addition to shuffling it. llvm-svn: 215056
Diffstat (limited to 'llvm/utils/shuffle_fuzz.py')
-rwxr-xr-xllvm/utils/shuffle_fuzz.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/llvm/utils/shuffle_fuzz.py b/llvm/utils/shuffle_fuzz.py
index f6a4408..cd523f4 100755
--- a/llvm/utils/shuffle_fuzz.py
+++ b/llvm/utils/shuffle_fuzz.py
@@ -26,14 +26,28 @@ def main():
help='Show verbose output')
parser.add_argument('--fixed-num-shuffles', type=int,
help='Specify a fixed number of shuffles to test')
+ parser.add_argument('--fixed-bit-width', type=int, choices=[128, 256],
+ help='Specify a fixed bit width of vector to test')
parser.add_argument('--triple',
help='Specify a triple string to include in the IR')
args = parser.parse_args()
random.seed(args.seed)
- width = random.choice([2, 4, 8, 16, 32, 64])
- element_type = random.choice(['i8', 'i16', 'i32', 'i64', 'f32', 'f64'])
+ if args.fixed_bit_width is not None:
+ if args.fixed_bit_width == 128:
+ (width, element_type) = random.choice(
+ [(2, 'i64'), (4, 'i32'), (8, 'i16'), (16, 'i8'),
+ (2, 'f64'), (4, 'f32')])
+ elif args.fixed_bit_width == 256:
+ (width, element_type) = random.choice([
+ (4, 'i64'), (8, 'i32'), (16, 'i16'), (32, 'i8'),
+ (4, 'f64'), (8, 'f32')])
+ else:
+ sys.exit(1) # Checked above by argument parsing.
+ else:
+ width = random.choice([2, 4, 8, 16, 32, 64])
+ element_type = random.choice(['i8', 'i16', 'i32', 'i64', 'f32', 'f64'])
# FIXME: Support blends.
shuffle_indices = [-1] + range(width)